/* eslint-disable no-unused-expressions */
/* eslint-disable eqeqeq */
/* eslint-disable no-undef */
/*eslint-disable*/
// tslint: disable 该行以下的内容都不再检查
// @ts-nocheck # 忽略全文
var KJUR,
	YAHOO,
	dbits,
	CryptoJS =
		CryptoJS ||
		(function (a) {
			var t = {},
				e = (t.lib = {}),
				i = (e.Base = {
					extend: function (t) {
						n.prototype = this
						var e = new n()
						return (
							t && e.mixIn(t),
							e.hasOwnProperty('init') ||
								(e.init = function () {
									e.$super.init.apply(this, arguments)
								}),
							((e.init.prototype = e).$super = this),
							e
						)
					},
					create: function () {
						var t = this.extend()
						return t.init.apply(t, arguments), t
					},
					init: function () {},
					mixIn: function (t) {
						for (var e in t) t.hasOwnProperty(e) && (this[e] = t[e])
						t.hasOwnProperty('toString') && (this.toString = t.toString)
					},
					clone: function () {
						return this.init.prototype.extend(this)
					},
				})
			function n() {}
			var u = (e.WordArray = i.extend({
					init: function (t, e) {
						;(t = this.words = t || []), (this.sigBytes = null != e ? e : 4 * t.length)
					},
					toString: function (t) {
						return (t || s).stringify(this)
					},
					concat: function (t) {
						var e = this.words,
							i = t.words,
							n = this.sigBytes,
							r = t.sigBytes
						if ((this.clamp(), n % 4))
							for (var s = 0; s < r; s++) {
								var o = (i[s >>> 2] >>> (24 - (s % 4) * 8)) & 255
								e[(n + s) >>> 2] |= o << (24 - ((n + s) % 4) * 8)
							}
						else if (65535 < i.length) for (s = 0; s < r; s += 4) e[(n + s) >>> 2] = i[s >>> 2]
						else e.push.apply(e, i)
						return (this.sigBytes += r), this
					},
					clamp: function () {
						var t = this.words,
							e = this.sigBytes
						;(t[e >>> 2] &= 4294967295 << (32 - (e % 4) * 8)), (t.length = a.ceil(e / 4))
					},
					clone: function () {
						var t = i.clone.call(this)
						return (t.words = this.words.slice(0)), t
					},
					random: function (t) {
						for (var e = [], i = 0; i < t; i += 4) e.push((4294967296 * a.random()) | 0)
						return new u.init(e, t)
					},
				})),
				r = (t.enc = {}),
				s = (r.Hex = {
					stringify: function (t) {
						for (var e = t.words, i = t.sigBytes, n = [], r = 0; r < i; r++) {
							var s = (e[r >>> 2] >>> (24 - (r % 4) * 8)) & 255
							n.push((s >>> 4).toString(16)), n.push((15 & s).toString(16))
						}
						return n.join('')
					},
					parse: function (t) {
						for (var e = t.length, i = [], n = 0; n < e; n += 2)
							i[n >>> 3] |= parseInt(t.substr(n, 2), 16) << (24 - (n % 8) * 4)
						return new u.init(i, e / 2)
					},
				}),
				o = (r.Latin1 = {
					stringify: function (t) {
						for (var e = t.words, i = t.sigBytes, n = [], r = 0; r < i; r++) {
							var s = (e[r >>> 2] >>> (24 - (r % 4) * 8)) & 255
							n.push(String.fromCharCode(s))
						}
						return n.join('')
					},
					parse: function (t) {
						for (var e = t.length, i = [], n = 0; n < e; n++)
							i[n >>> 2] |= (255 & t.charCodeAt(n)) << (24 - (n % 4) * 8)
						return new u.init(i, e)
					},
				}),
				h = (r.Utf8 = {
					stringify: function (t) {
						try {
							return decodeURIComponent(escape(o.stringify(t)))
						} catch (t) {
							throw new Error('Malformed UTF-8 data')
						}
					},
					parse: function (t) {
						return o.parse(unescape(encodeURIComponent(t)))
					},
				}),
				F = (e.BufferedBlockAlgorithm = i.extend({
					reset: function () {
						;(this._data = new u.init()), (this._nDataBytes = 0)
					},
					_append: function (t) {
						'string' == typeof t && (t = h.parse(t)), this._data.concat(t), (this._nDataBytes += t.sigBytes)
					},
					_process: function (t) {
						var e = this._data,
							i = e.words,
							n = e.sigBytes,
							r = this.blockSize,
							s = n / (4 * r),
							o = (s = t ? a.ceil(s) : a.max((0 | s) - this._minBufferSize, 0)) * r,
							n = a.min(4 * o, n)
						if (o) {
							for (var h = 0; h < o; h += r) this._doProcessBlock(i, h)
							var F = i.splice(0, o)
							e.sigBytes -= n
						}
						return new u.init(F, n)
					},
					clone: function () {
						var t = i.clone.call(this)
						return (t._data = this._data.clone()), t
					},
					_minBufferSize: 0,
				})),
				c =
					((e.Hasher = F.extend({
						cfg: i.extend(),
						init: function (t) {
							;(this.cfg = this.cfg.extend(t)), this.reset()
						},
						reset: function () {
							F.reset.call(this), this._doReset()
						},
						update: function (t) {
							return this._append(t), this._process(), this
						},
						finalize: function (t) {
							return t && this._append(t), this._doFinalize()
						},
						blockSize: 16,
						_createHelper: function (i) {
							return function (t, e) {
								return new i.init(e).finalize(t)
							}
						},
						_createHmacHelper: function (i) {
							return function (t, e) {
								return new c.HMAC.init(i, e).finalize(t)
							}
						},
					})),
					(t.algo = {}))
			return t
		})(Math)
CryptoJS.lib.Cipher ||
	(function () {
		var t = CryptoJS,
			e = t.lib,
			i = e.Base,
			o = e.WordArray,
			n = e.BufferedBlockAlgorithm,
			r = t.enc,
			s = (r.Utf8, r.Base64),
			h = t.algo.EvpKDF,
			F = (e.Cipher = n.extend({
				cfg: i.extend(),
				createEncryptor: function (t, e) {
					return this.create(this._ENC_XFORM_MODE, t, e)
				},
				createDecryptor: function (t, e) {
					return this.create(this._DEC_XFORM_MODE, t, e)
				},
				init: function (t, e, i) {
					;(this.cfg = this.cfg.extend(i)), (this._xformMode = t), (this._key = e), this.reset()
				},
				reset: function () {
					n.reset.call(this), this._doReset()
				},
				process: function (t) {
					return this._append(t), this._process()
				},
				finalize: function (t) {
					return t && this._append(t), this._doFinalize()
				},
				keySize: 4,
				ivSize: 4,
				_ENC_XFORM_MODE: 1,
				_DEC_XFORM_MODE: 2,
				_createHelper: function (n) {
					return {
						encrypt: function (t, e, i) {
							return a(e).encrypt(n, t, e, i)
						},
						decrypt: function (t, e, i) {
							return a(e).decrypt(n, t, e, i)
						},
					}
				},
			}))
		function a(t) {
			return 'string' == typeof t ? l : g
		}
		e.StreamCipher = F.extend({
			_doFinalize: function () {
				return this._process(!0)
			},
			blockSize: 1,
		})
		var u = (t.mode = {}),
			r = (e.BlockCipherMode = i.extend({
				createEncryptor: function (t, e) {
					return this.Encryptor.create(t, e)
				},
				createDecryptor: function (t, e) {
					return this.Decryptor.create(t, e)
				},
				init: function (t, e) {
					;(this._cipher = t), (this._iv = e)
				},
			})),
			r = (u.CBC =
				(((u = r.extend()).Encryptor = u.extend({
					processBlock: function (t, e) {
						var i = this._cipher,
							n = i.blockSize
						c.call(this, t, e, n), i.encryptBlock(t, e), (this._prevBlock = t.slice(e, e + n))
					},
				})),
				(u.Decryptor = u.extend({
					processBlock: function (t, e) {
						var i = this._cipher,
							n = i.blockSize,
							r = t.slice(e, e + n)
						i.decryptBlock(t, e), c.call(this, t, e, n), (this._prevBlock = r)
					},
				})),
				u))
		function c(t, e, i) {
			var n,
				r = this._iv
			r ? ((n = r), (this._iv = void 0)) : (n = this._prevBlock)
			for (var s = 0; s < i; s++) t[e + s] ^= n[s]
		}
		var u = ((t.pad = {}).Pkcs7 = {
				pad: function (t, e) {
					for (
						var e = 4 * e,
							i = e - (t.sigBytes % e),
							n = (i << 24) | (i << 16) | (i << 8) | i,
							r = [],
							s = 0;
						s < i;
						s += 4
					)
						r.push(n)
					e = o.create(r, i)
					t.concat(e)
				},
				unpad: function (t) {
					var e = 255 & t.words[(t.sigBytes - 1) >>> 2]
					t.sigBytes -= e
				},
			}),
			p =
				((e.BlockCipher = F.extend({
					cfg: F.cfg.extend({ mode: r, padding: u }),
					reset: function () {
						F.reset.call(this)
						var t,
							e = this.cfg,
							i = e.iv,
							e = e.mode
						this._xformMode == this._ENC_XFORM_MODE
							? (t = e.createEncryptor)
							: ((t = e.createDecryptor), (this._minBufferSize = 1)),
							(this._mode = t.call(e, this, i && i.words))
					},
					_doProcessBlock: function (t, e) {
						this._mode.processBlock(t, e)
					},
					_doFinalize: function () {
						var t,
							e = this.cfg.padding
						return (
							this._xformMode == this._ENC_XFORM_MODE
								? (e.pad(this._data, this.blockSize), (t = this._process(!0)))
								: ((t = this._process(!0)), e.unpad(t)),
							t
						)
					},
					blockSize: 4,
				})),
				(e.CipherParams = i.extend({
					init: function (t) {
						this.mixIn(t)
					},
					toString: function (t) {
						return (t || this.formatter).stringify(this)
					},
				}))),
			u = ((t.format = {}).OpenSSL = {
				stringify: function (t) {
					var e = t.ciphertext,
						t = t.salt
					return (t ? o.create([1398893684, 1701076831]).concat(t).concat(e) : e).toString(s)
				},
				parse: function (t) {
					var e,
						i = s.parse(t),
						t = i.words
					return (
						1398893684 == t[0] &&
							1701076831 == t[1] &&
							((e = o.create(t.slice(2, 4))), t.splice(0, 4), (i.sigBytes -= 16)),
						p.create({ ciphertext: i, salt: e })
					)
				},
			}),
			g = (e.SerializableCipher = i.extend({
				cfg: i.extend({ format: u }),
				encrypt: function (t, e, i, n) {
					n = this.cfg.extend(n)
					var r = t.createEncryptor(i, n),
						e = r.finalize(e),
						r = r.cfg
					return p.create({
						ciphertext: e,
						key: i,
						iv: r.iv,
						algorithm: t,
						mode: r.mode,
						padding: r.padding,
						blockSize: t.blockSize,
						formatter: n.format,
					})
				},
				decrypt: function (t, e, i, n) {
					return (
						(n = this.cfg.extend(n)),
						(e = this._parse(e, n.format)),
						t.createDecryptor(i, n).finalize(e.ciphertext)
					)
				},
				_parse: function (t, e) {
					return 'string' == typeof t ? e.parse(t, this) : t
				},
			})),
			t = ((t.kdf = {}).OpenSSL = {
				execute: function (t, e, i, n) {
					n = n || o.random(8)
					;(t = h.create({ keySize: e + i }).compute(t, n)), (i = o.create(t.words.slice(e), 4 * i))
					return (t.sigBytes = 4 * e), p.create({ key: t, iv: i, salt: n })
				},
			}),
			l = (e.PasswordBasedCipher = g.extend({
				cfg: g.cfg.extend({ kdf: t }),
				encrypt: function (t, e, i, n) {
					i = (n = this.cfg.extend(n)).kdf.execute(i, t.keySize, t.ivSize)
					n.iv = i.iv
					n = g.encrypt.call(this, t, e, i.key, n)
					return n.mixIn(i), n
				},
				decrypt: function (t, e, i, n) {
					;(n = this.cfg.extend(n)), (e = this._parse(e, n.format))
					i = n.kdf.execute(i, t.keySize, t.ivSize, e.salt)
					return (n.iv = i.iv), g.decrypt.call(this, t, e, i.key, n)
				},
			}))
	})(),
	((YAHOO = void 0 === YAHOO || !YAHOO ? {} : YAHOO).namespace = function () {
		for (var t, e, i = arguments, n = null, r = 0; r < i.length; r += 1)
			for (e = ('' + i[r]).split('.'), n = YAHOO, t = 'YAHOO' == e[0] ? 1 : 0; t < e.length; t += 1)
				(n[e[t]] = n[e[t]] || {}), (n = n[e[t]])
		return n
	}),
	(YAHOO.log = function (t, e, i) {
		var n = YAHOO.widget.Logger
		return !(!n || !n.log) && n.log(t, e, i)
	}),
	(YAHOO.register = function (t, e, i) {
		var n,
			r,
			s,
			o = YAHOO.env.modules
		for (
			o[t] || (o[t] = { versions: [], builds: [] }),
				n = o[t],
				o = i.version,
				i = i.build,
				r = YAHOO.env.listeners,
				n.name = t,
				n.version = o,
				n.build = i,
				n.versions.push(o),
				n.builds.push(i),
				n.mainClass = e,
				s = 0;
			s < r.length;
			s += 1
		)
			r[s](n)
		e ? ((e.VERSION = o), (e.BUILD = i)) : YAHOO.log('mainClass is undefined for module ' + t, 'warn')
	}),
	(YAHOO.env = YAHOO.env || { modules: [], listeners: [] }),
	(YAHOO.env.getVersion = function (t) {
		return YAHOO.env.modules[t] || null
	}),
	(YAHOO.env.parseUA = function (t) {
		function e(t) {
			var e = 0
			return parseFloat(
				t.replace(/\./g, function () {
					return 1 == e++ ? '' : '.'
				})
			)
		}
		var i = navigator,
			n = {
				ie: 0,
				opera: 0,
				gecko: 0,
				webkit: 0,
				chrome: 0,
				mobile: null,
				air: 0,
				ipad: 0,
				iphone: 0,
				ipod: 0,
				ios: null,
				android: 0,
				webos: 0,
				caja: i && i.cajaVersion,
				secure: !1,
				os: null,
			},
			i = t || (navigator && navigator.userAgent),
			t = window && window.location,
			t = t && t.href
		return (
			(n.secure = t && 0 === t.toLowerCase().indexOf('https')),
			i &&
				(/windows|win32/i.test(i)
					? (n.os = 'windows')
					: /macintosh/i.test(i)
					? (n.os = 'macintosh')
					: /rhino/i.test(i) && (n.os = 'rhino'),
				/KHTML/.test(i) && (n.webkit = 1),
				(t = i.match(/AppleWebKit\/([^\s]*)/)) &&
					t[1] &&
					((n.webkit = e(t[1])),
					/ Mobile\//.test(i)
						? ((n.mobile = 'Apple'),
						  (t = i.match(/OS ([^\s]*)/)) && t[1] && (t = e(t[1].replace('_', '.'))),
						  (n.ios = t),
						  (n.ipad = n.ipod = n.iphone = 0),
						  (t = i.match(/iPad|iPod|iPhone/)) && t[0] && (n[t[0].toLowerCase()] = n.ios))
						: ((t = i.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/)) && (n.mobile = t[0]),
						  /webOS/.test(i) &&
								((n.mobile = 'WebOS'),
								(t = i.match(/webOS\/([^\s]*);/)) && t[1] && (n.webos = e(t[1]))),
						  / Android/.test(i) &&
								((n.mobile = 'Android'),
								(t = i.match(/Android ([^\s]*);/)) && t[1] && (n.android = e(t[1])))),
					(t = i.match(/Chrome\/([^\s]*)/)) && t[1]
						? (n.chrome = e(t[1]))
						: (t = i.match(/AdobeAIR\/([^\s]*)/)) && (n.air = t[0])),
				n.webkit ||
					((t = i.match(/Opera[\s\/]([^\s]*)/)) && t[1]
						? ((n.opera = e(t[1])),
						  (t = i.match(/Version\/([^\s]*)/)) && t[1] && (n.opera = e(t[1])),
						  (t = i.match(/Opera Mini[^;]*/)) && (n.mobile = t[0]))
						: (t = i.match(/MSIE\s([^;]*)/)) && t[1]
						? (n.ie = e(t[1]))
						: (t = i.match(/Gecko\/([^\s]*)/)) &&
						  ((n.gecko = 1), (t = i.match(/rv:([^\s\)]*)/)) && t[1] && (n.gecko = e(t[1]))))),
			n
		)
	}),
	(YAHOO.env.ua = YAHOO.env.parseUA()),
	(function () {
		if ((YAHOO.namespace('util', 'widget', 'example'), 'undefined' != typeof YAHOO_config)) {
			var t,
				e = YAHOO_config.listener,
				i = YAHOO.env.listeners,
				n = !0
			if (e) {
				for (t = 0; t < i.length; t++)
					if (i[t] == e) {
						n = !1
						break
					}
				n && i.push(e)
			}
		}
	})(),
	(YAHOO.lang = YAHOO.lang || {}),
	(function () {
		var g = YAHOO.lang,
			s = Object.prototype,
			F = [],
			e = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#x27;', '/': '&#x2F;', '`': '&#x60;' },
			o = ['toString', 'valueOf'],
			t = {
				isArray: function (t) {
					return '[object Array]' === s.toString.apply(t)
				},
				isBoolean: function (t) {
					return 'boolean' == typeof t
				},
				isFunction: function (t) {
					return 'function' == typeof t || '[object Function]' === s.toString.apply(t)
				},
				isNull: function (t) {
					return null === t
				},
				isNumber: function (t) {
					return 'number' == typeof t && isFinite(t)
				},
				isObject: function (t) {
					return (t && ('object' == typeof t || g.isFunction(t))) || !1
				},
				isString: function (t) {
					return 'string' == typeof t
				},
				isUndefined: function (t) {
					return void 0 === t
				},
				_IEEnumFix: YAHOO.env.ua.ie
					? function (t, e) {
							for (var i, n, r = 0; r < o.length; r += 1)
								(n = e[(i = o[r])]), g.isFunction(n) && n != s[i] && (t[i] = n)
					  }
					: function () {},
				escapeHTML: function (t) {
					return t.replace(/[&<>"'\/`]/g, function (t) {
						return e[t]
					})
				},
				extend: function (t, e, i) {
					if (!e || !t) throw new Error('extend failed, please check that all dependencies are included.')
					function n() {}
					if (
						((n.prototype = e.prototype),
						(t.prototype = new n()),
						((t.prototype.constructor = t).superclass = e.prototype),
						e.prototype.constructor == s.constructor && (e.prototype.constructor = e),
						i)
					) {
						for (var r in i) g.hasOwnProperty(i, r) && (t.prototype[r] = i[r])
						g._IEEnumFix(t.prototype, i)
					}
				},
				augmentObject: function (t, e) {
					if (!e || !t) throw new Error('Absorb failed, verify dependencies.')
					var i,
						n,
						r = arguments,
						s = r[2]
					if (s && !0 !== s) for (i = 2; i < r.length; i += 1) t[r[i]] = e[r[i]]
					else {
						for (n in e) (!s && n in t) || (t[n] = e[n])
						g._IEEnumFix(t, e)
					}
					return t
				},
				augmentProto: function (t, e) {
					if (!e || !t) throw new Error('Augment failed, verify dependencies.')
					for (var i = [t.prototype, e.prototype], n = 2; n < arguments.length; n += 1) i.push(arguments[n])
					return g.augmentObject.apply(this, i), t
				},
				dump: function (t, e) {
					var i,
						n,
						r = []
					if (!g.isObject(t)) return t + ''
					if (t instanceof Date || ('nodeType' in t && 'tagName' in t)) return t
					if (g.isFunction(t)) return 'f(){...}'
					if (((e = g.isNumber(e) ? e : 3), g.isArray(t))) {
						for (r.push('['), i = 0, n = t.length; i < n; i += 1)
							g.isObject(t[i]) ? r.push(0 < e ? g.dump(t[i], e - 1) : '{...}') : r.push(t[i]),
								r.push(', ')
						1 < r.length && r.pop(), r.push(']')
					} else {
						for (i in (r.push('{'), t))
							g.hasOwnProperty(t, i) &&
								(r.push(i + ' => '),
								g.isObject(t[i]) ? r.push(0 < e ? g.dump(t[i], e - 1) : '{...}') : r.push(t[i]),
								r.push(', '))
						1 < r.length && r.pop(), r.push('}')
					}
					return r.join('')
				},
				substitute: function (t, e, i, n) {
					for (
						var r, s, o, h, F, a, u, c = [], p = t.length;
						!((r = t.lastIndexOf('{', p)) < 0) && !((s = t.indexOf('}', r)) < r + 1);

					)
						(h = null),
							-1 < (a = (u = F = t.substring(r + 1, s)).indexOf(' ')) &&
								((h = u.substring(a + 1)), (u = u.substring(0, a))),
							(o = e[u]),
							i && (o = i(u, o, h)),
							g.isObject(o)
								? (o = g.isArray(o)
										? g.dump(o, parseInt(h, 10))
										: (-1 < (a = (h = h || '').indexOf('dump')) && (h = h.substring(4)),
										  '[object Object]' === (u = o.toString()) || -1 < a
												? g.dump(o, parseInt(h, 10))
												: u))
								: g.isString(o) || g.isNumber(o) || ((o = '~-' + c.length + '-~'), (c[c.length] = F)),
							(t = t.substring(0, r) + o + t.substring(s + 1)),
							!1 === n && (p = r - 1)
					for (r = c.length - 1; 0 <= r; r -= 1)
						t = t.replace(new RegExp('~-' + r + '-~'), '{' + c[r] + '}', 'g')
					return t
				},
				trim: function (e) {
					try {
						return e.replace(/^\s+|\s+$/g, '')
					} catch (t) {
						return e
					}
				},
				merge: function () {
					for (var t = {}, e = arguments, i = e.length, n = 0; n < i; n += 1) g.augmentObject(t, e[n], !0)
					return t
				},
				later: function (t, e, i, n, r) {
					;(t = t || 0), (e = e || {})
					var s,
						o = i,
						h = n
					if (!(o = g.isString(i) ? e[i] : o)) throw new TypeError('method undefined')
					return (
						g.isUndefined(n) || g.isArray(h) || (h = [n]),
						(n = function () {
							o.apply(e, h || F)
						}),
						(s = (r ? setInterval : setTimeout)(n, t)),
						{
							interval: r,
							cancel: function () {
								;(this.interval ? clearInterval : clearTimeout)(s)
							},
						}
					)
				},
				isValue: function (t) {
					return g.isObject(t) || g.isString(t) || g.isNumber(t) || g.isBoolean(t)
				},
			}
		;(g.hasOwnProperty = s.hasOwnProperty
			? function (t, e) {
					return t && t.hasOwnProperty && t.hasOwnProperty(e)
			  }
			: function (t, e) {
					return !g.isUndefined(t[e]) && t.constructor.prototype[e] !== t[e]
			  }),
			t.augmentObject(g, t, !0),
			((YAHOO.util.Lang = g).augment = g.augmentProto),
			(YAHOO.augment = g.augmentProto),
			(YAHOO.extend = g.extend)
	})(),
	YAHOO.register('yahoo', YAHOO, { version: '2.9.0', build: '2800' })
var canary = 0xdeadbeefcafe,
	j_lm = 15715070 == (16777215 & canary)
function BigInteger(t, e, i) {
	null != t &&
		('number' == typeof t
			? this.fromNumber(t, e, i)
			: null == e && 'string' != typeof t
			? this.fromString(t, 256)
			: this.fromString(t, e))
}
function nbi() {
	return new BigInteger(null)
}
function am1(t, e, i, n, r, s) {
	for (; 0 <= --s; ) {
		var o = e * this[t++] + i[n] + r
		;(r = Math.floor(o / 67108864)), (i[n++] = 67108863 & o)
	}
	return r
}
function am2(t, e, i, n, r, s) {
	for (var o = 32767 & e, h = e >> 15; 0 <= --s; ) {
		var F = 32767 & this[t],
			a = this[t++] >> 15,
			u = h * F + a * o
		;(r = ((F = o * F + ((32767 & u) << 15) + i[n] + (1073741823 & r)) >>> 30) + (u >>> 15) + h * a + (r >>> 30)),
			(i[n++] = 1073741823 & F)
	}
	return r
}
function am3(t, e, i, n, r, s) {
	for (var o = 16383 & e, h = e >> 14; 0 <= --s; ) {
		var F = 16383 & this[t],
			a = this[t++] >> 14,
			u = h * F + a * o
		;(r = ((F = o * F + ((16383 & u) << 14) + i[n] + r) >> 28) + (u >> 14) + h * a), (i[n++] = 268435455 & F)
	}
	return r
}
;(dbits =
	j_lm && 'Microsoft Internet Explorer' == navigator.appName
		? ((BigInteger.prototype.am = am2), 30)
		: j_lm && 'Netscape' != navigator.appName
		? ((BigInteger.prototype.am = am1), 26)
		: ((BigInteger.prototype.am = am3), 28)),
	(BigInteger.prototype.DB = dbits),
	(BigInteger.prototype.DM = (1 << dbits) - 1),
	(BigInteger.prototype.DV = 1 << dbits)
var BI_FP = 52
;(BigInteger.prototype.FV = Math.pow(2, BI_FP)),
	(BigInteger.prototype.F1 = BI_FP - dbits),
	(BigInteger.prototype.F2 = 2 * dbits - BI_FP)
for (
	var BI_RM = '0123456789abcdefghijklmnopqrstuvwxyz', BI_RC = new Array(), rr = '0'.charCodeAt(0), vv = 0;
	vv <= 9;
	++vv
)
	BI_RC[rr++] = vv
for (rr = 'a'.charCodeAt(0), vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv
for (rr = 'A'.charCodeAt(0), vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv
function int2char(t) {
	return BI_RM.charAt(t)
}
function intAt(t, e) {
	e = BI_RC[t.charCodeAt(e)]
	return null == e ? -1 : e
}
function bnpCopyTo(t) {
	for (var e = this.t - 1; 0 <= e; --e) t[e] = this[e]
	;(t.t = this.t), (t.s = this.s)
}
function bnpFromInt(t) {
	;(this.t = 1), (this.s = t < 0 ? -1 : 0), 0 < t ? (this[0] = t) : t < -1 ? (this[0] = t + this.DV) : (this.t = 0)
}
function nbv(t) {
	var e = nbi()
	return e.fromInt(t), e
}
function bnpFromString(t, e) {
	var i
	if (16 == e) i = 4
	else if (8 == e) i = 3
	else if (256 == e) i = 8
	else if (2 == e) i = 1
	else if (32 == e) i = 5
	else {
		if (4 != e) return void this.fromRadix(t, e)
		i = 2
	}
	;(this.t = 0), (this.s = 0)
	for (var n = t.length, r = !1, s = 0; 0 <= --n; ) {
		var o = 8 == i ? 255 & t[n] : intAt(t, n)
		o < 0
			? '-' == t.charAt(n) && (r = !0)
			: ((r = !1),
			  0 == s
					? (this[this.t++] = o)
					: s + i > this.DB
					? ((this[this.t - 1] |= (o & ((1 << (this.DB - s)) - 1)) << s),
					  (this[this.t++] = o >> (this.DB - s)))
					: (this[this.t - 1] |= o << s),
			  (s += i) >= this.DB && (s -= this.DB))
	}
	8 == i && 0 != (128 & t[0]) && ((this.s = -1), 0 < s && (this[this.t - 1] |= ((1 << (this.DB - s)) - 1) << s)),
		this.clamp(),
		r && BigInteger.ZERO.subTo(this, this)
}
function bnpClamp() {
	for (var t = this.s & this.DM; 0 < this.t && this[this.t - 1] == t; ) --this.t
}
function bnToString(t) {
	if (this.s < 0) return '-' + this.negate().toString(t)
	var e
	if (16 == t) e = 4
	else if (8 == t) e = 3
	else if (2 == t) e = 1
	else if (32 == t) e = 5
	else {
		if (4 != t) return this.toRadix(t)
		e = 2
	}
	var i,
		n = (1 << e) - 1,
		r = !1,
		s = '',
		o = this.t,
		h = this.DB - ((o * this.DB) % e)
	if (0 < o--)
		for (h < this.DB && 0 < (i = this[o] >> h) && ((r = !0), (s = int2char(i))); 0 <= o; )
			h < e
				? ((i = (this[o] & ((1 << h) - 1)) << (e - h)), (i |= this[--o] >> (h += this.DB - e)))
				: ((i = (this[o] >> (h -= e)) & n), h <= 0 && ((h += this.DB), --o)),
				(r = 0 < i ? !0 : r) && (s += int2char(i))
	return r ? s : '0'
}
function bnNegate() {
	var t = nbi()
	return BigInteger.ZERO.subTo(this, t), t
}
function bnAbs() {
	return this.s < 0 ? this.negate() : this
}
function bnCompareTo(t) {
	var e = this.s - t.s
	if (0 != e) return e
	var i = this.t
	if (0 != (e = i - t.t)) return this.s < 0 ? -e : e
	for (; 0 <= --i; ) if (0 != (e = this[i] - t[i])) return e
	return 0
}
function nbits(t) {
	var e,
		i = 1
	return (
		0 != (e = t >>> 16) && ((t = e), (i += 16)),
		0 != (e = t >> 8) && ((t = e), (i += 8)),
		0 != (e = t >> 4) && ((t = e), (i += 4)),
		0 != (e = t >> 2) && ((t = e), (i += 2)),
		0 != (e = t >> 1) && ((t = e), (i += 1)),
		i
	)
}
function bnBitLength() {
	return this.t <= 0 ? 0 : this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM))
}
function bnpDLShiftTo(t, e) {
	for (var i = this.t - 1; 0 <= i; --i) e[i + t] = this[i]
	for (i = t - 1; 0 <= i; --i) e[i] = 0
	;(e.t = this.t + t), (e.s = this.s)
}
function bnpDRShiftTo(t, e) {
	for (var i = t; i < this.t; ++i) e[i - t] = this[i]
	;(e.t = Math.max(this.t - t, 0)), (e.s = this.s)
}
function bnpLShiftTo(t, e) {
	for (
		var i = t % this.DB,
			n = this.DB - i,
			r = (1 << n) - 1,
			s = Math.floor(t / this.DB),
			o = (this.s << i) & this.DM,
			h = this.t - 1;
		0 <= h;
		--h
	)
		(e[h + s + 1] = (this[h] >> n) | o), (o = (this[h] & r) << i)
	for (h = s - 1; 0 <= h; --h) e[h] = 0
	;(e[s] = o), (e.t = this.t + s + 1), (e.s = this.s), e.clamp()
}
function bnpRShiftTo(t, e) {
	e.s = this.s
	var i = Math.floor(t / this.DB)
	if (i >= this.t) e.t = 0
	else {
		var n = t % this.DB,
			r = this.DB - n,
			s = (1 << n) - 1
		e[0] = this[i] >> n
		for (var o = i + 1; o < this.t; ++o) (e[o - i - 1] |= (this[o] & s) << r), (e[o - i] = this[o] >> n)
		0 < n && (e[this.t - i - 1] |= (this.s & s) << r), (e.t = this.t - i), e.clamp()
	}
}
function bnpSubTo(t, e) {
	for (var i = 0, n = 0, r = Math.min(t.t, this.t); i < r; )
		(n += this[i] - t[i]), (e[i++] = n & this.DM), (n >>= this.DB)
	if (t.t < this.t) {
		for (n -= t.s; i < this.t; ) (n += this[i]), (e[i++] = n & this.DM), (n >>= this.DB)
		n += this.s
	} else {
		for (n += this.s; i < t.t; ) (n -= t[i]), (e[i++] = n & this.DM), (n >>= this.DB)
		n -= t.s
	}
	;(e.s = n < 0 ? -1 : 0), n < -1 ? (e[i++] = this.DV + n) : 0 < n && (e[i++] = n), (e.t = i), e.clamp()
}
function bnpMultiplyTo(t, e) {
	var i = this.abs(),
		n = t.abs(),
		r = i.t
	for (e.t = r + n.t; 0 <= --r; ) e[r] = 0
	for (r = 0; r < n.t; ++r) e[r + i.t] = i.am(0, n[r], e, r, 0, i.t)
	;(e.s = 0), e.clamp(), this.s != t.s && BigInteger.ZERO.subTo(e, e)
}
function bnpSquareTo(t) {
	for (var e = this.abs(), i = (t.t = 2 * e.t); 0 <= --i; ) t[i] = 0
	for (i = 0; i < e.t - 1; ++i) {
		var n = e.am(i, e[i], t, 2 * i, 0, 1)
		;(t[i + e.t] += e.am(i + 1, 2 * e[i], t, 2 * i + 1, n, e.t - i - 1)) >= e.DV &&
			((t[i + e.t] -= e.DV), (t[i + e.t + 1] = 1))
	}
	0 < t.t && (t[t.t - 1] += e.am(i, e[i], t, 2 * i, 0, 1)), (t.s = 0), t.clamp()
}
function bnpDivRemTo(t, e, i) {
	var n = t.abs()
	if (!(n.t <= 0)) {
		var r = this.abs()
		if (r.t < n.t) return null != e && e.fromInt(0), void (null != i && this.copyTo(i))
		null == i && (i = nbi())
		var s = nbi(),
			o = this.s,
			h = t.s,
			t = this.DB - nbits(n[n.t - 1])
		0 < t ? (n.lShiftTo(t, s), r.lShiftTo(t, i)) : (n.copyTo(s), r.copyTo(i))
		var F = s.t,
			a = s[F - 1]
		if (0 != a) {
			var r = a * (1 << this.F1) + (1 < F ? s[F - 2] >> this.F2 : 0),
				u = this.FV / r,
				c = (1 << this.F1) / r,
				p = 1 << this.F2,
				g = i.t,
				l = g - F,
				f = null == e ? nbi() : e
			for (
				s.dlShiftTo(l, f),
					0 <= i.compareTo(f) && ((i[i.t++] = 1), i.subTo(f, i)),
					BigInteger.ONE.dlShiftTo(F, f),
					f.subTo(s, s);
				s.t < F;

			)
				s[s.t++] = 0
			for (; 0 <= --l; ) {
				var d = i[--g] == a ? this.DM : Math.floor(i[g] * u + (i[g - 1] + p) * c)
				if ((i[g] += s.am(0, d, i, l, 0, F)) < d)
					for (s.dlShiftTo(l, f), i.subTo(f, i); i[g] < --d; ) i.subTo(f, i)
			}
			null != e && (i.drShiftTo(F, e), o != h && BigInteger.ZERO.subTo(e, e)),
				(i.t = F),
				i.clamp(),
				0 < t && i.rShiftTo(t, i),
				o < 0 && BigInteger.ZERO.subTo(i, i)
		}
	}
}
function bnMod(t) {
	var e = nbi()
	return this.abs().divRemTo(t, null, e), this.s < 0 && 0 < e.compareTo(BigInteger.ZERO) && t.subTo(e, e), e
}
function Classic(t) {
	this.m = t
}
function cConvert(t) {
	return t.s < 0 || 0 <= t.compareTo(this.m) ? t.mod(this.m) : t
}
function cRevert(t) {
	return t
}
function cReduce(t) {
	t.divRemTo(this.m, null, t)
}
function cMulTo(t, e, i) {
	t.multiplyTo(e, i), this.reduce(i)
}
function cSqrTo(t, e) {
	t.squareTo(e), this.reduce(e)
}
function bnpInvDigit() {
	if (this.t < 1) return 0
	var t = this[0]
	if (0 == (1 & t)) return 0
	var e = 3 & t
	return 0 <
		(e =
			((e =
				((e = ((e = (e * (2 - (15 & t) * e)) & 15) * (2 - (255 & t) * e)) & 255) *
					(2 - (((65535 & t) * e) & 65535))) &
				65535) *
				(2 - ((t * e) % this.DV))) %
			this.DV)
		? this.DV - e
		: -e
}
function Montgomery(t) {
	;(this.m = t),
		(this.mp = t.invDigit()),
		(this.mpl = 32767 & this.mp),
		(this.mph = this.mp >> 15),
		(this.um = (1 << (t.DB - 15)) - 1),
		(this.mt2 = 2 * t.t)
}
function montConvert(t) {
	var e = nbi()
	return (
		t.abs().dlShiftTo(this.m.t, e),
		e.divRemTo(this.m, null, e),
		t.s < 0 && 0 < e.compareTo(BigInteger.ZERO) && this.m.subTo(e, e),
		e
	)
}
function montRevert(t) {
	var e = nbi()
	return t.copyTo(e), this.reduce(e), e
}
function montReduce(t) {
	for (; t.t <= this.mt2; ) t[t.t++] = 0
	for (var e = 0; e < this.m.t; ++e) {
		var i = 32767 & t[e],
			n = (i * this.mpl + (((i * this.mph + (t[e] >> 15) * this.mpl) & this.um) << 15)) & t.DM
		for (t[(i = e + this.m.t)] += this.m.am(0, n, t, e, 0, this.m.t); t[i] >= t.DV; ) (t[i] -= t.DV), t[++i]++
	}
	t.clamp(), t.drShiftTo(this.m.t, t), 0 <= t.compareTo(this.m) && t.subTo(this.m, t)
}
function montSqrTo(t, e) {
	t.squareTo(e), this.reduce(e)
}
function montMulTo(t, e, i) {
	t.multiplyTo(e, i), this.reduce(i)
}
function bnpIsEven() {
	return 0 == (0 < this.t ? 1 & this[0] : this.s)
}
function bnpExp(t, e) {
	if (4294967295 < t || t < 1) return BigInteger.ONE
	var i,
		n = nbi(),
		r = nbi(),
		s = e.convert(this),
		o = nbits(t) - 1
	for (s.copyTo(n); 0 <= --o; ) e.sqrTo(n, r), 0 < (t & (1 << o)) ? e.mulTo(r, s, n) : ((i = n), (n = r), (r = i))
	return e.revert(n)
}
function bnModPowInt(t, e) {
	e = new (t < 256 || e.isEven() ? Classic : Montgomery)(e)
	return this.exp(t, e)
}
function bnClone() {
	var t = nbi()
	return this.copyTo(t), t
}
function bnIntValue() {
	if (this.s < 0) {
		if (1 == this.t) return this[0] - this.DV
		if (0 == this.t) return -1
	} else {
		if (1 == this.t) return this[0]
		if (0 == this.t) return 0
	}
	return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]
}
function bnByteValue() {
	return 0 == this.t ? this.s : (this[0] << 24) >> 24
}
function bnShortValue() {
	return 0 == this.t ? this.s : (this[0] << 16) >> 16
}
function bnpChunkSize(t) {
	return Math.floor((Math.LN2 * this.DB) / Math.log(t))
}
function bnSigNum() {
	return this.s < 0 ? -1 : this.t <= 0 || (1 == this.t && this[0] <= 0) ? 0 : 1
}
function bnpToRadix(t) {
	if ((null == t && (t = 10), 0 == this.signum() || t < 2 || 36 < t)) return '0'
	var e = this.chunkSize(t),
		i = Math.pow(t, e),
		n = nbv(i),
		r = nbi(),
		s = nbi(),
		o = ''
	for (this.divRemTo(n, r, s); 0 < r.signum(); )
		(o = (i + s.intValue()).toString(t).substr(1) + o), r.divRemTo(n, r, s)
	return s.intValue().toString(t) + o
}
function bnpFromRadix(t, e) {
	this.fromInt(0)
	for (
		var i = this.chunkSize((e = null == e ? 10 : e)), n = Math.pow(e, i), r = !1, s = 0, o = 0, h = 0;
		h < t.length;
		++h
	) {
		var F = intAt(t, h)
		F < 0
			? '-' == t.charAt(h) && 0 == this.signum() && (r = !0)
			: ((o = e * o + F), ++s >= i && (this.dMultiply(n), this.dAddOffset(o, 0), (o = s = 0)))
	}
	0 < s && (this.dMultiply(Math.pow(e, s)), this.dAddOffset(o, 0)), r && BigInteger.ZERO.subTo(this, this)
}
function bnpFromNumber(t, e, i) {
	if ('number' == typeof e)
		if (t < 2) this.fromInt(1)
		else
			for (
				this.fromNumber(t, i),
					this.testBit(t - 1) || this.bitwiseTo(BigInteger.ONE.shiftLeft(t - 1), op_or, this),
					this.isEven() && this.dAddOffset(1, 0);
				!this.isProbablePrime(e);

			)
				this.dAddOffset(2, 0), this.bitLength() > t && this.subTo(BigInteger.ONE.shiftLeft(t - 1), this)
	else {
		var n = new Array(),
			i = 7 & t
		;(n.length = 1 + (t >> 3)), e.nextBytes(n), 0 < i ? (n[0] &= (1 << i) - 1) : (n[0] = 0), this.fromString(n, 256)
	}
}
function bnToByteArray() {
	var t = this.t,
		e = new Array()
	e[0] = this.s
	var i,
		n = this.DB - ((t * this.DB) % 8),
		r = 0
	if (0 < t--)
		for (
			n < this.DB && (i = this[t] >> n) != (this.s & this.DM) >> n && (e[r++] = i | (this.s << (this.DB - n)));
			0 <= t;

		)
			n < 8
				? ((i = (this[t] & ((1 << n) - 1)) << (8 - n)), (i |= this[--t] >> (n += this.DB - 8)))
				: ((i = (this[t] >> (n -= 8)) & 255), n <= 0 && ((n += this.DB), --t)),
				0 != (128 & i) && (i |= -256),
				0 == r && (128 & this.s) != (128 & i) && ++r,
				(0 < r || i != this.s) && (e[r++] = i)
	return e
}
function bnEquals(t) {
	return 0 == this.compareTo(t)
}
function bnMin(t) {
	return this.compareTo(t) < 0 ? this : t
}
function bnMax(t) {
	return 0 < this.compareTo(t) ? this : t
}
function bnpBitwiseTo(t, e, i) {
	for (var n, r = Math.min(t.t, this.t), s = 0; s < r; ++s) i[s] = e(this[s], t[s])
	if (t.t < this.t) {
		for (n = t.s & this.DM, s = r; s < this.t; ++s) i[s] = e(this[s], n)
		i.t = this.t
	} else {
		for (n = this.s & this.DM, s = r; s < t.t; ++s) i[s] = e(n, t[s])
		i.t = t.t
	}
	;(i.s = e(this.s, t.s)), i.clamp()
}
function op_and(t, e) {
	return t & e
}
function bnAnd(t) {
	var e = nbi()
	return this.bitwiseTo(t, op_and, e), e
}
function op_or(t, e) {
	return t | e
}
function bnOr(t) {
	var e = nbi()
	return this.bitwiseTo(t, op_or, e), e
}
function op_xor(t, e) {
	return t ^ e
}
function bnXor(t) {
	var e = nbi()
	return this.bitwiseTo(t, op_xor, e), e
}
function op_andnot(t, e) {
	return t & ~e
}
function bnAndNot(t) {
	var e = nbi()
	return this.bitwiseTo(t, op_andnot, e), e
}
function bnNot() {
	for (var t = nbi(), e = 0; e < this.t; ++e) t[e] = this.DM & ~this[e]
	return (t.t = this.t), (t.s = ~this.s), t
}
function bnShiftLeft(t) {
	var e = nbi()
	return t < 0 ? this.rShiftTo(-t, e) : this.lShiftTo(t, e), e
}
function bnShiftRight(t) {
	var e = nbi()
	return t < 0 ? this.lShiftTo(-t, e) : this.rShiftTo(t, e), e
}
function lbit(t) {
	if (0 == t) return -1
	var e = 0
	return (
		0 == (65535 & t) && ((t >>= 16), (e += 16)),
		0 == (255 & t) && ((t >>= 8), (e += 8)),
		0 == (15 & t) && ((t >>= 4), (e += 4)),
		0 == (3 & t) && ((t >>= 2), (e += 2)),
		0 == (1 & t) && ++e,
		e
	)
}
function bnGetLowestSetBit() {
	for (var t = 0; t < this.t; ++t) if (0 != this[t]) return t * this.DB + lbit(this[t])
	return this.s < 0 ? this.t * this.DB : -1
}
function cbit(t) {
	for (var e = 0; 0 != t; ) (t &= t - 1), ++e
	return e
}
function bnBitCount() {
	for (var t = 0, e = this.s & this.DM, i = 0; i < this.t; ++i) t += cbit(this[i] ^ e)
	return t
}
function bnTestBit(t) {
	var e = Math.floor(t / this.DB)
	return e >= this.t ? 0 != this.s : 0 != (this[e] & (1 << t % this.DB))
}
function bnpChangeBit(t, e) {
	t = BigInteger.ONE.shiftLeft(t)
	return this.bitwiseTo(t, e, t), t
}
function bnSetBit(t) {
	return this.changeBit(t, op_or)
}
function bnClearBit(t) {
	return this.changeBit(t, op_andnot)
}
function bnFlipBit(t) {
	return this.changeBit(t, op_xor)
}
function bnpAddTo(t, e) {
	for (var i = 0, n = 0, r = Math.min(t.t, this.t); i < r; )
		(n += this[i] + t[i]), (e[i++] = n & this.DM), (n >>= this.DB)
	if (t.t < this.t) {
		for (n += t.s; i < this.t; ) (n += this[i]), (e[i++] = n & this.DM), (n >>= this.DB)
		n += this.s
	} else {
		for (n += this.s; i < t.t; ) (n += t[i]), (e[i++] = n & this.DM), (n >>= this.DB)
		n += t.s
	}
	;(e.s = n < 0 ? -1 : 0), 0 < n ? (e[i++] = n) : n < -1 && (e[i++] = this.DV + n), (e.t = i), e.clamp()
}
function bnAdd(t) {
	var e = nbi()
	return this.addTo(t, e), e
}
function bnSubtract(t) {
	var e = nbi()
	return this.subTo(t, e), e
}
function bnMultiply(t) {
	var e = nbi()
	return this.multiplyTo(t, e), e
}
function bnSquare() {
	var t = nbi()
	return this.squareTo(t), t
}
function bnDivide(t) {
	var e = nbi()
	return this.divRemTo(t, e, null), e
}
function bnRemainder(t) {
	var e = nbi()
	return this.divRemTo(t, null, e), e
}
function bnDivideAndRemainder(t) {
	var e = nbi(),
		i = nbi()
	return this.divRemTo(t, e, i), new Array(e, i)
}
function bnpDMultiply(t) {
	;(this[this.t] = this.am(0, t - 1, this, 0, 0, this.t)), ++this.t, this.clamp()
}
function bnpDAddOffset(t, e) {
	if (0 != t) {
		for (; this.t <= e; ) this[this.t++] = 0
		for (this[e] += t; this[e] >= this.DV; ) (this[e] -= this.DV), ++e >= this.t && (this[this.t++] = 0), ++this[e]
	}
}
function NullExp() {}
function nNop(t) {
	return t
}
function nMulTo(t, e, i) {
	t.multiplyTo(e, i)
}
function nSqrTo(t, e) {
	t.squareTo(e)
}
function bnPow(t) {
	return this.exp(t, new NullExp())
}
function bnpMultiplyLowerTo(t, e, i) {
	var n,
		r = Math.min(this.t + t.t, e)
	for (i.s = 0, i.t = r; 0 < r; ) i[--r] = 0
	for (n = i.t - this.t; r < n; ++r) i[r + this.t] = this.am(0, t[r], i, r, 0, this.t)
	for (n = Math.min(t.t, e); r < n; ++r) this.am(0, t[r], i, r, 0, e - r)
	i.clamp()
}
function bnpMultiplyUpperTo(t, e, i) {
	var n = (i.t = this.t + t.t - --e)
	for (i.s = 0; 0 <= --n; ) i[n] = 0
	for (n = Math.max(e - this.t, 0); n < t.t; ++n) i[this.t + n - e] = this.am(e - n, t[n], i, 0, 0, this.t + n - e)
	i.clamp(), i.drShiftTo(1, i)
}
function Barrett(t) {
	;(this.r2 = nbi()),
		(this.q3 = nbi()),
		BigInteger.ONE.dlShiftTo(2 * t.t, this.r2),
		(this.mu = this.r2.divide(t)),
		(this.m = t)
}
function barrettConvert(t) {
	if (t.s < 0 || t.t > 2 * this.m.t) return t.mod(this.m)
	if (t.compareTo(this.m) < 0) return t
	var e = nbi()
	return t.copyTo(e), this.reduce(e), e
}
function barrettRevert(t) {
	return t
}
function barrettReduce(t) {
	for (
		t.drShiftTo(this.m.t - 1, this.r2),
			t.t > this.m.t + 1 && ((t.t = this.m.t + 1), t.clamp()),
			this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3),
			this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);
		t.compareTo(this.r2) < 0;

	)
		t.dAddOffset(1, this.m.t + 1)
	for (t.subTo(this.r2, t); 0 <= t.compareTo(this.m); ) t.subTo(this.m, t)
}
function barrettSqrTo(t, e) {
	t.squareTo(e), this.reduce(e)
}
function barrettMulTo(t, e, i) {
	t.multiplyTo(e, i), this.reduce(i)
}
function bnModPow(t, e) {
	var i = t.bitLength(),
		n = nbv(1)
	if (i <= 0) return n
	var r = i < 18 ? 1 : i < 48 ? 3 : i < 144 ? 4 : i < 768 ? 5 : 6,
		s = new (i < 8 ? Classic : e.isEven() ? Barrett : Montgomery)(e),
		o = new Array(),
		h = 3,
		F = r - 1,
		a = (1 << r) - 1
	if (((o[1] = s.convert(this)), 1 < r)) {
		var u = nbi()
		for (s.sqrTo(o[1], u); h <= a; ) (o[h] = nbi()), s.mulTo(u, o[h - 2], o[h]), (h += 2)
	}
	for (var c, p, g = t.t - 1, l = !0, f = nbi(), i = nbits(t[g]) - 1; 0 <= g; ) {
		for (
			F <= i
				? (c = (t[g] >> (i - F)) & a)
				: ((c = (t[g] & ((1 << (i + 1)) - 1)) << (F - i)), 0 < g && (c |= t[g - 1] >> (this.DB + i - F))),
				h = r;
			0 == (1 & c);

		)
			(c >>= 1), --h
		if (((i -= h) < 0 && ((i += this.DB), --g), l)) o[c].copyTo(n), (l = !1)
		else {
			for (; 1 < h; ) s.sqrTo(n, f), s.sqrTo(f, n), (h -= 2)
			0 < h ? s.sqrTo(n, f) : ((p = n), (n = f), (f = p)), s.mulTo(f, o[c], n)
		}
		for (; 0 <= g && 0 == (t[g] & (1 << i)); )
			s.sqrTo(n, f), (p = n), (n = f), (f = p), --i < 0 && ((i = this.DB - 1), --g)
	}
	return s.revert(n)
}
function bnGCD(t) {
	var e = this.s < 0 ? this.negate() : this.clone(),
		i = t.s < 0 ? t.negate() : t.clone()
	e.compareTo(i) < 0 && ((r = e), (e = i), (i = r))
	var n = e.getLowestSetBit(),
		r = i.getLowestSetBit()
	if (r < 0) return e
	for (0 < (r = n < r ? n : r) && (e.rShiftTo(r, e), i.rShiftTo(r, i)); 0 < e.signum(); )
		0 < (n = e.getLowestSetBit()) && e.rShiftTo(n, e),
			0 < (n = i.getLowestSetBit()) && i.rShiftTo(n, i),
			0 <= e.compareTo(i) ? (e.subTo(i, e), e.rShiftTo(1, e)) : (i.subTo(e, i), i.rShiftTo(1, i))
	return 0 < r && i.lShiftTo(r, i), i
}
function bnpModInt(t) {
	if (t <= 0) return 0
	var e = this.DV % t,
		i = this.s < 0 ? t - 1 : 0
	if (0 < this.t)
		if (0 == e) i = this[0] % t
		else for (var n = this.t - 1; 0 <= n; --n) i = (e * i + this[n]) % t
	return i
}
function bnModInverse(t) {
	var e = t.isEven()
	if ((this.isEven() && e) || 0 == t.signum()) return BigInteger.ZERO
	for (var i = t.clone(), n = this.clone(), r = nbv(1), s = nbv(0), o = nbv(0), h = nbv(1); 0 != i.signum(); ) {
		for (; i.isEven(); )
			i.rShiftTo(1, i),
				e
					? ((r.isEven() && s.isEven()) || (r.addTo(this, r), s.subTo(t, s)), r.rShiftTo(1, r))
					: s.isEven() || s.subTo(t, s),
				s.rShiftTo(1, s)
		for (; n.isEven(); )
			n.rShiftTo(1, n),
				e
					? ((o.isEven() && h.isEven()) || (o.addTo(this, o), h.subTo(t, h)), o.rShiftTo(1, o))
					: h.isEven() || h.subTo(t, h),
				h.rShiftTo(1, h)
		0 <= i.compareTo(n)
			? (i.subTo(n, i), e && r.subTo(o, r), s.subTo(h, s))
			: (n.subTo(i, n), e && o.subTo(r, o), h.subTo(s, h))
	}
	return 0 != n.compareTo(BigInteger.ONE)
		? BigInteger.ZERO
		: 0 <= h.compareTo(t)
		? h.subtract(t)
		: h.signum() < 0
		? (h.addTo(t, h), h.signum() < 0 ? h.add(t) : h)
		: h
}
;(Classic.prototype.convert = cConvert),
	(Classic.prototype.revert = cRevert),
	(Classic.prototype.reduce = cReduce),
	(Classic.prototype.mulTo = cMulTo),
	(Classic.prototype.sqrTo = cSqrTo),
	(Montgomery.prototype.convert = montConvert),
	(Montgomery.prototype.revert = montRevert),
	(Montgomery.prototype.reduce = montReduce),
	(Montgomery.prototype.mulTo = montMulTo),
	(Montgomery.prototype.sqrTo = montSqrTo),
	(BigInteger.prototype.copyTo = bnpCopyTo),
	(BigInteger.prototype.fromInt = bnpFromInt),
	(BigInteger.prototype.fromString = bnpFromString),
	(BigInteger.prototype.clamp = bnpClamp),
	(BigInteger.prototype.dlShiftTo = bnpDLShiftTo),
	(BigInteger.prototype.drShiftTo = bnpDRShiftTo),
	(BigInteger.prototype.lShiftTo = bnpLShiftTo),
	(BigInteger.prototype.rShiftTo = bnpRShiftTo),
	(BigInteger.prototype.subTo = bnpSubTo),
	(BigInteger.prototype.multiplyTo = bnpMultiplyTo),
	(BigInteger.prototype.squareTo = bnpSquareTo),
	(BigInteger.prototype.divRemTo = bnpDivRemTo),
	(BigInteger.prototype.invDigit = bnpInvDigit),
	(BigInteger.prototype.isEven = bnpIsEven),
	(BigInteger.prototype.exp = bnpExp),
	(BigInteger.prototype.toString = bnToString),
	(BigInteger.prototype.negate = bnNegate),
	(BigInteger.prototype.abs = bnAbs),
	(BigInteger.prototype.compareTo = bnCompareTo),
	(BigInteger.prototype.bitLength = bnBitLength),
	(BigInteger.prototype.mod = bnMod),
	(BigInteger.prototype.modPowInt = bnModPowInt),
	(BigInteger.ZERO = nbv(0)),
	(BigInteger.ONE = nbv(1)),
	(NullExp.prototype.convert = nNop),
	(NullExp.prototype.revert = nNop),
	(NullExp.prototype.mulTo = nMulTo),
	(NullExp.prototype.sqrTo = nSqrTo),
	(Barrett.prototype.convert = barrettConvert),
	(Barrett.prototype.revert = barrettRevert),
	(Barrett.prototype.reduce = barrettReduce),
	(Barrett.prototype.mulTo = barrettMulTo),
	(Barrett.prototype.sqrTo = barrettSqrTo)
var lowprimes = [
		2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107,
		109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
		233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359,
		367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491,
		499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641,
		643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787,
		797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941,
		947, 953, 967, 971, 977, 983, 991, 997,
	],
	lplim = (1 << 26) / lowprimes[lowprimes.length - 1]
function bnIsProbablePrime(t) {
	var e,
		i = this.abs()
	if (1 == i.t && i[0] <= lowprimes[lowprimes.length - 1]) {
		for (e = 0; e < lowprimes.length; ++e) if (i[0] == lowprimes[e]) return !0
		return !1
	}
	if (i.isEven()) return !1
	for (e = 1; e < lowprimes.length; ) {
		for (var n = lowprimes[e], r = e + 1; r < lowprimes.length && n < lplim; ) n *= lowprimes[r++]
		for (n = i.modInt(n); e < r; ) if (n % lowprimes[e++] == 0) return !1
	}
	return i.millerRabin(t)
}
function bnpMillerRabin(t) {
	var e = this.subtract(BigInteger.ONE),
		i = e.getLowestSetBit()
	if (i <= 0) return !1
	var n = e.shiftRight(i)
	;(t = (t + 1) >> 1) > lowprimes.length && (t = lowprimes.length)
	for (var r = nbi(), s = 0; s < t; ++s) {
		r.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)])
		var o = r.modPow(n, this)
		if (0 != o.compareTo(BigInteger.ONE) && 0 != o.compareTo(e)) {
			for (var h = 1; h++ < i && 0 != o.compareTo(e); )
				if (0 == (o = o.modPowInt(2, this)).compareTo(BigInteger.ONE)) return !1
			if (0 != o.compareTo(e)) return !1
		}
	}
	return !0
}
function Arcfour() {
	;(this.i = 0), (this.j = 0), (this.S = new Array())
}
function ARC4init(t) {
	for (var e, i, n = 0; n < 256; ++n) this.S[n] = n
	for (n = e = 0; n < 256; ++n)
		(e = (e + this.S[n] + t[n % t.length]) & 255), (i = this.S[n]), (this.S[n] = this.S[e]), (this.S[e] = i)
	;(this.i = 0), (this.j = 0)
}
function ARC4next() {
	var t
	return (
		(this.i = (this.i + 1) & 255),
		(this.j = (this.j + this.S[this.i]) & 255),
		(t = this.S[this.i]),
		(this.S[this.i] = this.S[this.j]),
		(this.S[this.j] = t),
		this.S[(t + this.S[this.i]) & 255]
	)
}
function prng_newstate() {
	return new Arcfour()
}
;(BigInteger.prototype.chunkSize = bnpChunkSize),
	(BigInteger.prototype.toRadix = bnpToRadix),
	(BigInteger.prototype.fromRadix = bnpFromRadix),
	(BigInteger.prototype.fromNumber = bnpFromNumber),
	(BigInteger.prototype.bitwiseTo = bnpBitwiseTo),
	(BigInteger.prototype.changeBit = bnpChangeBit),
	(BigInteger.prototype.addTo = bnpAddTo),
	(BigInteger.prototype.dMultiply = bnpDMultiply),
	(BigInteger.prototype.dAddOffset = bnpDAddOffset),
	(BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo),
	(BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo),
	(BigInteger.prototype.modInt = bnpModInt),
	(BigInteger.prototype.millerRabin = bnpMillerRabin),
	(BigInteger.prototype.clone = bnClone),
	(BigInteger.prototype.intValue = bnIntValue),
	(BigInteger.prototype.byteValue = bnByteValue),
	(BigInteger.prototype.shortValue = bnShortValue),
	(BigInteger.prototype.signum = bnSigNum),
	(BigInteger.prototype.toByteArray = bnToByteArray),
	(BigInteger.prototype.equals = bnEquals),
	(BigInteger.prototype.min = bnMin),
	(BigInteger.prototype.max = bnMax),
	(BigInteger.prototype.and = bnAnd),
	(BigInteger.prototype.or = bnOr),
	(BigInteger.prototype.xor = bnXor),
	(BigInteger.prototype.andNot = bnAndNot),
	(BigInteger.prototype.not = bnNot),
	(BigInteger.prototype.shiftLeft = bnShiftLeft),
	(BigInteger.prototype.shiftRight = bnShiftRight),
	(BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit),
	(BigInteger.prototype.bitCount = bnBitCount),
	(BigInteger.prototype.testBit = bnTestBit),
	(BigInteger.prototype.setBit = bnSetBit),
	(BigInteger.prototype.clearBit = bnClearBit),
	(BigInteger.prototype.flipBit = bnFlipBit),
	(BigInteger.prototype.add = bnAdd),
	(BigInteger.prototype.subtract = bnSubtract),
	(BigInteger.prototype.multiply = bnMultiply),
	(BigInteger.prototype.divide = bnDivide),
	(BigInteger.prototype.remainder = bnRemainder),
	(BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder),
	(BigInteger.prototype.modPow = bnModPow),
	(BigInteger.prototype.modInverse = bnModInverse),
	(BigInteger.prototype.pow = bnPow),
	(BigInteger.prototype.gcd = bnGCD),
	(BigInteger.prototype.isProbablePrime = bnIsProbablePrime),
	(BigInteger.prototype.square = bnSquare),
	(Arcfour.prototype.init = ARC4init),
	(Arcfour.prototype.next = ARC4next)
var rng_state,
	rng_psize = 256
function rng_seed_int(t) {
	;(rng_pool[rng_pptr++] ^= 255 & t),
		(rng_pool[rng_pptr++] ^= (t >> 8) & 255),
		(rng_pool[rng_pptr++] ^= (t >> 16) & 255),
		(rng_pool[rng_pptr++] ^= (t >> 24) & 255),
		rng_psize <= rng_pptr && (rng_pptr -= rng_psize)
}
function rng_seed_time() {
	rng_seed_int(new Date().getTime())
}
if (null == rng_pool) {
	var rng_pool = new Array(),
		rng_pptr = 0
	if ('Netscape' == navigator.appName && navigator.appVersion < '5' && window.crypto)
		for (var z = window.crypto.random(32), t = 0; t < z.length; ++t) rng_pool[rng_pptr++] = 255 & z.charCodeAt(t)
	for (; rng_pptr < rng_psize; )
		(t = Math.floor(65536 * Math.random())), (rng_pool[rng_pptr++] = t >>> 8), (rng_pool[rng_pptr++] = 255 & t)
	;(rng_pptr = 0), rng_seed_time()
}
function rng_get_byte() {
	if (null == rng_state) {
		for (
			rng_seed_time(), (rng_state = prng_newstate()).init(rng_pool), rng_pptr = 0;
			rng_pptr < rng_pool.length;
			++rng_pptr
		)
			rng_pool[rng_pptr] = 0
		rng_pptr = 0
	}
	return rng_state.next()
}
function rng_get_bytes(t) {
	for (var e = 0; e < t.length; ++e) t[e] = rng_get_byte()
}
function SecureRandom() {}
function parseBigInt(t, e) {
	return new BigInteger(t, e)
}
function linebrk(t, e) {
	for (var i = '', n = 0; n + e < t.length; ) (i += t.substring(n, n + e) + '\n'), (n += e)
	return i + t.substring(n, t.length)
}
function byte2Hex(t) {
	return t < 16 ? '0' + t.toString(16) : t.toString(16)
}
function pkcs1pad2(t, e) {
	if (e < t.length + 11) return alert('Message too long for RSA'), null
	for (var i = new Array(), n = t.length - 1; 0 <= n && 0 < e; ) {
		var r = t.charCodeAt(n--)
		r < 128
			? (i[--e] = r)
			: 127 < r && r < 2048
			? ((i[--e] = (63 & r) | 128), (i[--e] = (r >> 6) | 192))
			: ((i[--e] = (63 & r) | 128), (i[--e] = ((r >> 6) & 63) | 128), (i[--e] = (r >> 12) | 224))
	}
	i[--e] = 0
	for (var s = new SecureRandom(), o = new Array(); 2 < e; ) {
		for (o[0] = 0; 0 == o[0]; ) s.nextBytes(o)
		i[--e] = o[0]
	}
	return (i[--e] = 2), (i[--e] = 0), new BigInteger(i)
}
function oaep_mgf1_arr(t, e, i) {
	for (var n = '', r = 0; n.length < e; )
		(n += i(
			String.fromCharCode.apply(
				String,
				t.concat([(4278190080 & r) >> 24, (16711680 & r) >> 16, (65280 & r) >> 8, 255 & r])
			)
		)),
			(r += 1)
	return n
}
SecureRandom.prototype.nextBytes = rng_get_bytes
var SHA1_SIZE = 20
function oaep_pad(t, e, i) {
	if (t.length + 2 * SHA1_SIZE + 2 > e) throw 'Message too long for RSA'
	for (var n = '', r = 0; r < e - t.length - 2 * SHA1_SIZE - 2; r += 1) n += '\0'
	var s = rstr_sha1('') + n + '' + t,
		o = new Array(SHA1_SIZE)
	new SecureRandom().nextBytes(o)
	var h = oaep_mgf1_arr(o, s.length, i || rstr_sha1),
		F = []
	for (r = 0; r < s.length; r += 1) F[r] = s.charCodeAt(r) ^ h.charCodeAt(r)
	var a = oaep_mgf1_arr(F, o.length, rstr_sha1),
		u = [0]
	for (r = 0; r < o.length; r += 1) u[r + 1] = o[r] ^ a.charCodeAt(r)
	return new BigInteger(u.concat(F))
}
function RSAKey() {
	;(this.n = null),
		(this.e = 0),
		(this.d = null),
		(this.p = null),
		(this.q = null),
		(this.dmp1 = null),
		(this.dmq1 = null),
		(this.coeff = null)
}
function RSASetPublic(t, e) {
	;(this.isPublic = !0),
		'string' != typeof t
			? ((this.n = t), (this.e = e))
			: null != t && null != e && 0 < t.length && 0 < e.length
			? ((this.n = parseBigInt(t, 16)), (this.e = parseInt(e, 16)))
			: alert('Invalid RSA public key')
}
function RSADoPublic(t) {
	return t.modPowInt(this.e, this.n)
}
function RSAEncrypt(t) {
	t = pkcs1pad2(t, (this.n.bitLength() + 7) >> 3)
	if (null == t) return null
	t = this.doPublic(t)
	if (null == t) return null
	t = t.toString(16)
	return 0 == (1 & t.length) ? t : '0' + t
}
function RSAEncryptOAEP(t, e) {
	e = oaep_pad(t, (this.n.bitLength() + 7) >> 3, e)
	if (null == e) return null
	e = this.doPublic(e)
	if (null == e) return null
	e = e.toString(16)
	return 0 == (1 & e.length) ? e : '0' + e
}
function ECFieldElementFp(t, e) {
	;(this.x = e), (this.q = t)
}
function feFpEquals(t) {
	return t == this || (this.q.equals(t.q) && this.x.equals(t.x))
}
function feFpToBigInteger() {
	return this.x
}
function feFpNegate() {
	return new ECFieldElementFp(this.q, this.x.negate().mod(this.q))
}
function feFpAdd(t) {
	return new ECFieldElementFp(this.q, this.x.add(t.toBigInteger()).mod(this.q))
}
function feFpSubtract(t) {
	return new ECFieldElementFp(this.q, this.x.subtract(t.toBigInteger()).mod(this.q))
}
function feFpMultiply(t) {
	return new ECFieldElementFp(this.q, this.x.multiply(t.toBigInteger()).mod(this.q))
}
function feFpSquare() {
	return new ECFieldElementFp(this.q, this.x.square().mod(this.q))
}
function feFpDivide(t) {
	return new ECFieldElementFp(this.q, this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))
}
function ECPointFp(t, e, i, n) {
	;(this.curve = t), (this.x = e), (this.y = i), (this.z = null == n ? BigInteger.ONE : n), (this.zinv = null)
}
function pointFpGetX() {
	return (
		null == this.zinv && (this.zinv = this.z.modInverse(this.curve.q)),
		this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))
	)
}
function pointFpGetY() {
	return (
		null == this.zinv && (this.zinv = this.z.modInverse(this.curve.q)),
		this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))
	)
}
function pointFpEquals(t) {
	return (
		t == this ||
		(this.isInfinity()
			? t.isInfinity()
			: t.isInfinity()
			? this.isInfinity()
			: !!t.y
					.toBigInteger()
					.multiply(this.z)
					.subtract(this.y.toBigInteger().multiply(t.z))
					.mod(this.curve.q)
					.equals(BigInteger.ZERO) &&
			  t.x
					.toBigInteger()
					.multiply(this.z)
					.subtract(this.x.toBigInteger().multiply(t.z))
					.mod(this.curve.q)
					.equals(BigInteger.ZERO))
	)
}
function pointFpIsInfinity() {
	return (
		(null == this.x && null == this.y) ||
		(this.z.equals(BigInteger.ZERO) && !this.y.toBigInteger().equals(BigInteger.ZERO))
	)
}
function pointFpNegate() {
	return new ECPointFp(this.curve, this.x, this.y.negate(), this.z)
}
function pointFpAdd(t) {
	if (this.isInfinity()) return t
	if (t.isInfinity()) return this
	var e = t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),
		i = t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q)
	if (BigInteger.ZERO.equals(i)) return BigInteger.ZERO.equals(e) ? this.twice() : this.curve.getInfinity()
	var n = new BigInteger('3'),
		r = this.x.toBigInteger(),
		s = this.y.toBigInteger(),
		o = (t.x.toBigInteger(), t.y.toBigInteger(), i.square()),
		h = o.multiply(i),
		r = r.multiply(o),
		o = e.square().multiply(this.z),
		i = o.subtract(r.shiftLeft(1)).multiply(t.z).subtract(h).multiply(i).mod(this.curve.q),
		e = r
			.multiply(n)
			.multiply(e)
			.subtract(s.multiply(h))
			.subtract(o.multiply(e))
			.multiply(t.z)
			.add(e.multiply(h))
			.mod(this.curve.q),
		t = h.multiply(this.z).multiply(t.z).mod(this.curve.q)
	return new ECPointFp(this.curve, this.curve.fromBigInteger(i), this.curve.fromBigInteger(e), t)
}
function pointFpTwice() {
	if (this.isInfinity()) return this
	if (0 == this.y.toBigInteger().signum()) return this.curve.getInfinity()
	var t = new BigInteger('3'),
		e = this.x.toBigInteger(),
		i = this.y.toBigInteger(),
		n = i.multiply(this.z),
		r = n.multiply(i).mod(this.curve.q),
		s = this.curve.a.toBigInteger(),
		i = e.square().multiply(t),
		s = (i = (i = !BigInteger.ZERO.equals(s) ? i.add(this.z.square().multiply(s)) : i).mod(this.curve.q))
			.square()
			.subtract(e.shiftLeft(3).multiply(r))
			.shiftLeft(1)
			.multiply(n)
			.mod(this.curve.q),
		i = i
			.multiply(t)
			.multiply(e)
			.subtract(r.shiftLeft(1))
			.shiftLeft(2)
			.multiply(r)
			.subtract(i.square().multiply(i))
			.mod(this.curve.q),
		n = n.square().multiply(n).shiftLeft(3).mod(this.curve.q)
	return new ECPointFp(this.curve, this.curve.fromBigInteger(s), this.curve.fromBigInteger(i), n)
}
function pointFpMultiply(t) {
	if (this.isInfinity()) return this
	if (0 == t.signum()) return this.curve.getInfinity()
	for (
		var e = t, i = e.multiply(new BigInteger('3')), n = this.negate(), r = this, s = i.bitLength() - 2;
		0 < s;
		--s
	) {
		var r = r.twice(),
			o = i.testBit(s)
		o != e.testBit(s) && (r = r.add(o ? this : n))
	}
	return r
}
function pointFpMultiplyTwo(t, e, i) {
	for (
		var n = t.bitLength() > i.bitLength() ? t.bitLength() - 1 : i.bitLength() - 1,
			r = this.curve.getInfinity(),
			s = this.add(e);
		0 <= n;

	)
		(r = r.twice()),
			t.testBit(n) ? (r = i.testBit(n) ? r.add(s) : r.add(this)) : i.testBit(n) && (r = r.add(e)),
			--n
	return r
}
function ECCurveFp(t, e, i) {
	;(this.q = t),
		(this.a = this.fromBigInteger(e)),
		(this.b = this.fromBigInteger(i)),
		(this.infinity = new ECPointFp(this, null, null))
}
function curveFpGetQ() {
	return this.q
}
function curveFpGetA() {
	return this.a
}
function curveFpGetB() {
	return this.b
}
function curveFpEquals(t) {
	return t == this || (this.q.equals(t.q) && this.a.equals(t.a) && this.b.equals(t.b))
}
function curveFpGetInfinity() {
	return this.infinity
}
function curveFpFromBigInteger(t) {
	return new ECFieldElementFp(this.q, t)
}
function curveFpDecodePointHex(t) {
	switch (parseInt(t.substr(0, 2), 16)) {
		case 0:
			return this.infinity
		case 2:
		case 3:
			return null
		case 4:
		case 6:
		case 7:
			var e = (t.length - 2) / 2,
				i = t.substr(2, e),
				e = t.substr(2 + e, e)
			return new ECPointFp(
				this,
				this.fromBigInteger(new BigInteger(i, 16)),
				this.fromBigInteger(new BigInteger(e, 16))
			)
		default:
			return null
	}
}
function SM3Digest() {
	;(this.BYTE_LENGTH = 64),
		(this.xBuf = new Array()),
		(this.xBufOff = 0),
		(this.byteCount = 0),
		(this.DIGEST_LENGTH = 32),
		(this.v0 = [1937774191, 1226093241, 388252375, 3666478592, 2842636476, 372324522, 3817729613, 2969243214]),
		(this.v0 = [1937774191, 1226093241, 388252375, -628488704, -1452330820, 372324522, -477237683, -1325724082]),
		(this.v = new Array(8)),
		(this.v_ = new Array(8)),
		(this.X0 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
		(this.X = new Array(68)),
		(this.xOff = 0),
		(this.T_00_15 = 2043430169),
		(this.T_16_63 = 2055708042),
		0 < arguments.length ? this.InitDigest(arguments[0]) : this.Init()
}
function SM2Cipher(t) {
	;(this.ct = 1),
		(this.p2 = null),
		(this.sm3keybase = null),
		(this.sm3c3 = null),
		(this.key = new Array(32)),
		(this.keyOff = 0),
		(this.cipherMode = void 0 !== t ? t : SM2CipherMode.C1C3C2)
}
;(RSAKey.prototype.doPublic = RSADoPublic),
	(RSAKey.prototype.setPublic = RSASetPublic),
	(RSAKey.prototype.encrypt = RSAEncrypt),
	(RSAKey.prototype.encryptOAEP = RSAEncryptOAEP),
	(RSAKey.prototype.type = 'RSA'),
	('undefined' != typeof KJUR && KJUR) || (KJUR = {}),
	(void 0 !== KJUR.asn1 && KJUR.asn1) || (KJUR.asn1 = {}),
	(KJUR.asn1.ASN1Util = new (function () {
		;(this.integerToByteHex = function (t) {
			t = t.toString(16)
			return (t = t.length % 2 == 1 ? '0' + t : t)
		}),
			(this.bigIntToMinTwosComplementsHex = function (t) {
				if ('-' != (r = t.toString(16)).substr(0, 1))
					r.length % 2 == 1 ? (r = '0' + r) : r.match(/^[0-7]/) || (r = '00' + r)
				else {
					var e = r.substr(1).length
					e % 2 == 1 ? (e += 1) : r.match(/^[0-7]/) || (e += 2)
					for (var i = '', n = 0; n < e; n++) i += 'f'
					var r = new BigInteger(i, 16).xor(t).add(BigInteger.ONE).toString(16).replace(/^-/, '')
				}
				return r
			}),
			(this.getPEMStringFromHex = function (t, e) {
				KJUR.asn1
				t = CryptoJS.enc.Hex.parse(t)
				return (
					'-----BEGIN ' +
					e +
					'-----\r\n' +
					CryptoJS.enc.Base64.stringify(t)
						.replace(/(.{64})/g, '$1\r\n')
						.replace(/\r\n$/, '') +
					'\r\n-----END ' +
					e +
					'-----\r\n'
				)
			}),
			(this.newObject = function (t) {
				var e = KJUR.asn1,
					i = Object.keys(t)
				if (1 != i.length) throw 'key of param shall be only one.'
				i = i[0]
				if (
					-1 ==
					':bool:int:bitstr:octstr:null:oid:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:'.indexOf(
						':' + i + ':'
					)
				)
					throw 'undefined key: ' + i
				if ('bool' == i) return new e.DERBoolean(t[i])
				if ('int' == i) return new e.DERInteger(t[i])
				if ('bitstr' == i) return new e.DERBitString(t[i])
				if ('octstr' == i) return new e.DEROctetString(t[i])
				if ('null' == i) return new e.DERNull(t[i])
				if ('oid' == i) return new e.DERObjectIdentifier(t[i])
				if ('utf8str' == i) return new e.DERUTF8String(t[i])
				if ('numstr' == i) return new e.DERNumericString(t[i])
				if ('prnstr' == i) return new e.DERPrintableString(t[i])
				if ('telstr' == i) return new e.DERTeletexString(t[i])
				if ('ia5str' == i) return new e.DERIA5String(t[i])
				if ('utctime' == i) return new e.DERUTCTime(t[i])
				if ('gentime' == i) return new e.DERGeneralizedTime(t[i])
				if ('seq' == i) {
					for (var n = t[i], r = [], s = 0; s < n.length; s++) {
						var o = e.ASN1Util.newObject(n[s])
						r.push(o)
					}
					return new e.DERSequence({ array: r })
				}
				if ('set' == i) {
					for (n = t[i], r = [], s = 0; s < n.length; s++) {
						o = e.ASN1Util.newObject(n[s])
						r.push(o)
					}
					return new e.DERSet({ array: r })
				}
				if ('tag' == i) {
					i = t[i]
					if ('[object Array]' === Object.prototype.toString.call(i) && 3 == i.length) {
						var h = e.ASN1Util.newObject(i[2])
						return new e.DERTaggedObject({ tag: i[0], explicit: i[1], obj: h })
					}
					h = {}
					if (
						(void 0 !== i.explicit && (h.explicit = i.explicit),
						void 0 !== i.tag && (h.tag = i.tag),
						void 0 === i.obj)
					)
						throw "obj shall be specified for 'tag'."
					return (h.obj = e.ASN1Util.newObject(i.obj)), new e.DERTaggedObject(h)
				}
			}),
			(this.jsonToASN1HEX = function (t) {
				return this.newObject(t).getEncodedHex()
			})
	})()),
	(KJUR.asn1.ASN1Object = function () {
		;(this.getLengthHexFromValue = function () {
			if (void 0 === this.hV || null == this.hV) throw 'this.hV is null or undefined.'
			if (this.hV.length % 2 == 1) throw 'value hex must be even length: n=' + ''.length + ',v=' + this.hV
			var t = this.hV.length / 2,
				e = t.toString(16)
			if ((e.length % 2 == 1 && (e = '0' + e), t < 128)) return e
			var i = e.length / 2
			if (15 < i) throw 'ASN.1 length too long to represent by 8x: n = ' + t.toString(16)
			return (128 + i).toString(16) + e
		}),
			(this.getEncodedHex = function () {
				return (
					(null != this.hTLV && !this.isModified) ||
						((this.hV = this.getFreshValueHex()),
						(this.hL = this.getLengthHexFromValue()),
						(this.hTLV = this.hT + this.hL + this.hV),
						(this.isModified = !1)),
					this.hTLV
				)
			}),
			(this.getValueHex = function () {
				return this.getEncodedHex(), this.hV
			}),
			(this.getFreshValueHex = function () {
				return ''
			})
	}),
	(KJUR.asn1.DERAbstractString = function (t) {
		KJUR.asn1.DERAbstractString.superclass.constructor.call(this)
		;(this.getString = function () {
			return this.s
		}),
			(this.setString = function (t) {
				;(this.hTLV = null), (this.isModified = !0), (this.s = t), (this.hV = stohex(this.s))
			}),
			(this.setStringHex = function (t) {
				;(this.hTLV = null), (this.isModified = !0), (this.s = null), (this.hV = t)
			}),
			(this.getFreshValueHex = function () {
				return this.hV
			}),
			void 0 !== t &&
				('string' == typeof t
					? this.setString(t)
					: void 0 !== t.str
					? this.setString(t.str)
					: void 0 !== t.hex && this.setStringHex(t.hex))
	}),
	YAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object),
	(KJUR.asn1.DERAbstractTime = function (t) {
		KJUR.asn1.DERAbstractTime.superclass.constructor.call(this)
		;(this.localDateToUTC = function (t) {
			return (utc = t.getTime() + 6e4 * t.getTimezoneOffset()), new Date(utc)
		}),
			(this.formatDate = function (t, e) {
				var i = this.zeroPadding,
					n = this.localDateToUTC(t),
					t = String(n.getFullYear())
				return (
					(t = 'utc' == e ? t.substr(2, 2) : t) +
					i(String(n.getMonth() + 1), 2) +
					i(String(n.getDate()), 2) +
					i(String(n.getHours()), 2) +
					i(String(n.getMinutes()), 2) +
					i(String(n.getSeconds()), 2) +
					'Z'
				)
			}),
			(this.zeroPadding = function (t, e) {
				return t.length >= e ? t : new Array(e - t.length + 1).join('0') + t
			}),
			(this.getString = function () {
				return this.s
			}),
			(this.setString = function (t) {
				;(this.hTLV = null), (this.isModified = !0), (this.s = t), (this.hV = stohex(t))
			}),
			(this.setByDateValue = function (t, e, i, n, r, s) {
				s = new Date(Date.UTC(t, e - 1, i, n, r, s, 0))
				this.setByDate(s)
			}),
			(this.getFreshValueHex = function () {
				return this.hV
			})
	}),
	YAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object),
	(KJUR.asn1.DERAbstractStructured = function (t) {
		KJUR.asn1.DERAbstractString.superclass.constructor.call(this)
		;(this.setByASN1ObjectArray = function (t) {
			;(this.hTLV = null), (this.isModified = !0), (this.asn1Array = t)
		}),
			(this.appendASN1Object = function (t) {
				;(this.hTLV = null), (this.isModified = !0), this.asn1Array.push(t)
			}),
			(this.asn1Array = new Array()),
			void 0 !== t && void 0 !== t.array && (this.asn1Array = t.array)
	}),
	YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object),
	(KJUR.asn1.DERBoolean = function () {
		KJUR.asn1.DERBoolean.superclass.constructor.call(this), (this.hT = '01'), (this.hTLV = '0101ff')
	}),
	YAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object),
	(KJUR.asn1.DERInteger = function (t) {
		KJUR.asn1.DERInteger.superclass.constructor.call(this),
			(this.hT = '02'),
			(this.setByBigInteger = function (t) {
				;(this.hTLV = null),
					(this.isModified = !0),
					(this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t))
			}),
			(this.setByInteger = function (t) {
				t = new BigInteger(String(t), 10)
				this.setByBigInteger(t)
			}),
			(this.setValueHex = function (t) {
				this.hV = t
			}),
			(this.getFreshValueHex = function () {
				return this.hV
			}),
			void 0 !== t &&
				(void 0 !== t.bigint
					? this.setByBigInteger(t.bigint)
					: void 0 !== t.int
					? this.setByInteger(t.int)
					: 'number' == typeof t
					? this.setByInteger(t)
					: void 0 !== t.hex && this.setValueHex(t.hex))
	}),
	YAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object),
	(KJUR.asn1.DERBitString = function (t) {
		KJUR.asn1.DERBitString.superclass.constructor.call(this),
			(this.hT = '03'),
			(this.setHexValueIncludingUnusedBits = function (t) {
				;(this.hTLV = null), (this.isModified = !0), (this.hV = t)
			}),
			(this.setUnusedBitsAndHexValue = function (t, e) {
				if (t < 0 || 7 < t) throw 'unused bits shall be from 0 to 7: u = ' + t
				t = '0' + t
				;(this.hTLV = null), (this.isModified = !0), (this.hV = t + e)
			}),
			(this.setByBinaryString = function (t) {
				var e = 8 - ((t = t.replace(/0+$/, '')).length % 8)
				8 == e && (e = 0)
				for (var i = 0; i <= e; i++) t += '0'
				for (var n = '', i = 0; i < t.length - 1; i += 8) {
					var r = t.substr(i, 8),
						r = parseInt(r, 2).toString(16)
					n += r = 1 == r.length ? '0' + r : r
				}
				;(this.hTLV = null), (this.isModified = !0), (this.hV = '0' + e + n)
			}),
			(this.setByBooleanArray = function (t) {
				for (var e = '', i = 0; i < t.length; i++) 1 == t[i] ? (e += '1') : (e += '0')
				this.setByBinaryString(e)
			}),
			(this.newFalseArray = function (t) {
				for (var e = new Array(t), i = 0; i < t; i++) e[i] = !1
				return e
			}),
			(this.getFreshValueHex = function () {
				return this.hV
			}),
			void 0 !== t &&
				('string' == typeof t && t.toLowerCase().match(/^[0-9a-f]+$/)
					? this.setHexValueIncludingUnusedBits(t)
					: void 0 !== t.hex
					? this.setHexValueIncludingUnusedBits(t.hex)
					: void 0 !== t.bin
					? this.setByBinaryString(t.bin)
					: void 0 !== t.array && this.setByBooleanArray(t.array))
	}),
	YAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object),
	(KJUR.asn1.DEROctetString = function (t) {
		KJUR.asn1.DEROctetString.superclass.constructor.call(this, t), (this.hT = '04')
	}),
	YAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString),
	(KJUR.asn1.DERNull = function () {
		KJUR.asn1.DERNull.superclass.constructor.call(this), (this.hT = '05'), (this.hTLV = '0500')
	}),
	YAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object),
	(KJUR.asn1.DERObjectIdentifier = function (t) {
		function h(t) {
			return (t = 1 == (t = t.toString(16)).length ? '0' + t : t)
		}
		KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this),
			(this.hT = '06'),
			(this.setValueHex = function (t) {
				;(this.hTLV = null), (this.isModified = !0), (this.s = null), (this.hV = t)
			}),
			(this.setValueOidString = function (t) {
				if (!t.match(/^[0-9.]+$/)) throw 'malformed oid string: ' + t
				var e = '',
					i = t.split('.'),
					t = 40 * parseInt(i[0]) + parseInt(i[1])
				;(e += h(t)), i.splice(0, 2)
				for (var n = 0; n < i.length; n++)
					e += (function (t) {
						var e = '',
							i = 7 - ((s = new BigInteger(t, 10).toString(2)).length % 7)
						7 == i && (i = 0)
						for (var n = '', r = 0; r < i; r++) n += '0'
						for (var s = n + s, r = 0; r < s.length - 1; r += 7) {
							var o = s.substr(r, 7)
							r != s.length - 7 && (o = '1' + o), (e += h(parseInt(o, 2)))
						}
						return e
					})(i[n])
				;(this.hTLV = null), (this.isModified = !0), (this.s = null), (this.hV = e)
			}),
			(this.setValueName = function (t) {
				if (void 0 === KJUR.asn1.x509.OID.name2oidList[t]) throw 'DERObjectIdentifier oidName undefined: ' + t
				t = KJUR.asn1.x509.OID.name2oidList[t]
				this.setValueOidString(t)
			}),
			(this.getFreshValueHex = function () {
				return this.hV
			}),
			void 0 !== t &&
				('string' == typeof t && t.match(/^[0-2].[0-9.]+$/)
					? this.setValueOidString(t)
					: void 0 !== KJUR.asn1.x509.OID.name2oidList[t]
					? this.setValueOidString(KJUR.asn1.x509.OID.name2oidList[t])
					: void 0 !== t.oid
					? this.setValueOidString(t.oid)
					: void 0 !== t.hex
					? this.setValueHex(t.hex)
					: void 0 !== t.name && this.setValueName(t.name))
	}),
	YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object),
	(KJUR.asn1.DERUTF8String = function (t) {
		KJUR.asn1.DERUTF8String.superclass.constructor.call(this, t), (this.hT = '0c')
	}),
	YAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString),
	(KJUR.asn1.DERNumericString = function (t) {
		KJUR.asn1.DERNumericString.superclass.constructor.call(this, t), (this.hT = '12')
	}),
	YAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString),
	(KJUR.asn1.DERPrintableString = function (t) {
		KJUR.asn1.DERPrintableString.superclass.constructor.call(this, t), (this.hT = '13')
	}),
	YAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString),
	(KJUR.asn1.DERTeletexString = function (t) {
		KJUR.asn1.DERTeletexString.superclass.constructor.call(this, t), (this.hT = '14')
	}),
	YAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString),
	(KJUR.asn1.DERIA5String = function (t) {
		KJUR.asn1.DERIA5String.superclass.constructor.call(this, t), (this.hT = '16')
	}),
	YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString),
	(KJUR.asn1.DERUTCTime = function (t) {
		KJUR.asn1.DERUTCTime.superclass.constructor.call(this, t),
			(this.hT = '17'),
			(this.setByDate = function (t) {
				;(this.hTLV = null),
					(this.isModified = !0),
					(this.date = t),
					(this.s = this.formatDate(this.date, 'utc')),
					(this.hV = stohex(this.s))
			}),
			void 0 !== t &&
				(void 0 !== t.str
					? this.setString(t.str)
					: 'string' == typeof t && t.match(/^[0-9]{12}Z$/)
					? this.setString(t)
					: void 0 !== t.hex
					? this.setStringHex(t.hex)
					: void 0 !== t.date && this.setByDate(t.date))
	}),
	YAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime),
	(KJUR.asn1.DERGeneralizedTime = function (t) {
		KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, t),
			(this.hT = '18'),
			(this.setByDate = function (t) {
				;(this.hTLV = null),
					(this.isModified = !0),
					(this.date = t),
					(this.s = this.formatDate(this.date, 'gen')),
					(this.hV = stohex(this.s))
			}),
			void 0 !== t &&
				(void 0 !== t.str
					? this.setString(t.str)
					: 'string' == typeof t && t.match(/^[0-9]{14}Z$/)
					? this.setString(t)
					: void 0 !== t.hex
					? this.setStringHex(t.hex)
					: void 0 !== t.date && this.setByDate(t.date))
	}),
	YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime),
	(KJUR.asn1.DERSequence = function (t) {
		KJUR.asn1.DERSequence.superclass.constructor.call(this, t),
			(this.hT = '30'),
			(this.getFreshValueHex = function () {
				for (var t = '', e = 0; e < this.asn1Array.length; e++) t += this.asn1Array[e].getEncodedHex()
				return (this.hV = t), this.hV
			})
	}),
	YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured),
	(KJUR.asn1.DERSet = function (t) {
		KJUR.asn1.DERSet.superclass.constructor.call(this, t),
			(this.hT = '31'),
			(this.getFreshValueHex = function () {
				for (var t = new Array(), e = 0; e < this.asn1Array.length; e++) {
					var i = this.asn1Array[e]
					t.push(i.getEncodedHex())
				}
				return t.sort(), (this.hV = t.join('')), this.hV
			})
	}),
	YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured),
	(KJUR.asn1.DERTaggedObject = function (t) {
		KJUR.asn1.DERTaggedObject.superclass.constructor.call(this),
			(this.hT = 'a0'),
			(this.hV = ''),
			(this.isExplicit = !0),
			(this.asn1Object = null),
			(this.setASN1Object = function (t, e, i) {
				;(this.hT = e),
					(this.isExplicit = t),
					(this.asn1Object = i),
					this.isExplicit
						? ((this.hV = this.asn1Object.getEncodedHex()), (this.hTLV = null), (this.isModified = !0))
						: ((this.hV = null),
						  (this.hTLV = i.getEncodedHex()),
						  (this.hTLV = this.hTLV.replace(/^../, e)),
						  (this.isModified = !1))
			}),
			(this.getFreshValueHex = function () {
				return this.hV
			}),
			void 0 !== t &&
				(void 0 !== t.tag && (this.hT = t.tag),
				void 0 !== t.explicit && (this.isExplicit = t.explicit),
				void 0 !== t.obj &&
					((this.asn1Object = t.obj), this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)))
	}),
	YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object),
	(ECFieldElementFp.prototype.equals = feFpEquals),
	(ECFieldElementFp.prototype.toBigInteger = feFpToBigInteger),
	(ECFieldElementFp.prototype.negate = feFpNegate),
	(ECFieldElementFp.prototype.add = feFpAdd),
	(ECFieldElementFp.prototype.subtract = feFpSubtract),
	(ECFieldElementFp.prototype.multiply = feFpMultiply),
	(ECFieldElementFp.prototype.square = feFpSquare),
	(ECFieldElementFp.prototype.divide = feFpDivide),
	(ECPointFp.prototype.getX = pointFpGetX),
	(ECPointFp.prototype.getY = pointFpGetY),
	(ECPointFp.prototype.equals = pointFpEquals),
	(ECPointFp.prototype.isInfinity = pointFpIsInfinity),
	(ECPointFp.prototype.negate = pointFpNegate),
	(ECPointFp.prototype.add = pointFpAdd),
	(ECPointFp.prototype.twice = pointFpTwice),
	(ECPointFp.prototype.multiply = pointFpMultiply),
	(ECPointFp.prototype.multiplyTwo = pointFpMultiplyTwo),
	(ECCurveFp.prototype.getQ = curveFpGetQ),
	(ECCurveFp.prototype.getA = curveFpGetA),
	(ECCurveFp.prototype.getB = curveFpGetB),
	(ECCurveFp.prototype.equals = curveFpEquals),
	(ECCurveFp.prototype.getInfinity = curveFpGetInfinity),
	(ECCurveFp.prototype.fromBigInteger = curveFpFromBigInteger),
	(ECCurveFp.prototype.decodePointHex = curveFpDecodePointHex),
	(ECFieldElementFp.prototype.getByteLength = function () {
		return Math.floor((this.toBigInteger().bitLength() + 7) / 8)
	}),
	(ECPointFp.prototype.getEncoded = function (t) {
		function e(t, e) {
			var i = t.toByteArrayUnsigned()
			if (e < i.length) i = i.slice(i.length - e)
			else for (; e > i.length; ) i.unshift(0)
			return i
		}
		var i = this.getX().toBigInteger(),
			n = this.getY().toBigInteger(),
			i = e(i, 32)
		return t ? (n.isEven() ? i.unshift(2) : i.unshift(3)) : (i.unshift(4), (i = i.concat(e(n, 32)))), i
	}),
	(ECPointFp.decodeFrom = function (t, e) {
		e[0]
		var i = e.length - 1,
			n = e.slice(1, 1 + i / 2),
			i = e.slice(1 + i / 2, 1 + i)
		n.unshift(0), i.unshift(0)
		;(n = new BigInteger(n)), (i = new BigInteger(i))
		return new ECPointFp(t, t.fromBigInteger(n), t.fromBigInteger(i))
	}),
	(ECPointFp.decodeFromHex = function (t, e) {
		e.substr(0, 2)
		var i = e.length - 2,
			n = e.substr(2, i / 2),
			i = e.substr(2 + i / 2, i / 2),
			n = new BigInteger(n, 16),
			i = new BigInteger(i, 16)
		return new ECPointFp(t, t.fromBigInteger(n), t.fromBigInteger(i))
	}),
	(ECPointFp.prototype.add2D = function (t) {
		if (this.isInfinity()) return t
		if (t.isInfinity()) return this
		if (this.x.equals(t.x)) return this.y.equals(t.y) ? this.twice() : this.curve.getInfinity()
		var e = t.x.subtract(this.x),
			e = t.y.subtract(this.y).divide(e),
			t = e.square().subtract(this.x).subtract(t.x),
			e = e.multiply(this.x.subtract(t)).subtract(this.y)
		return new ECPointFp(this.curve, t, e)
	}),
	(ECPointFp.prototype.twice2D = function () {
		if (this.isInfinity()) return this
		if (0 == this.y.toBigInteger().signum()) return this.curve.getInfinity()
		var t = this.curve.fromBigInteger(BigInteger.valueOf(2)),
			e = this.curve.fromBigInteger(BigInteger.valueOf(3)),
			e = this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(t)),
			t = e.square().subtract(this.x.multiply(t)),
			e = e.multiply(this.x.subtract(t)).subtract(this.y)
		return new ECPointFp(this.curve, t, e)
	}),
	(ECPointFp.prototype.multiply2D = function (t) {
		if (this.isInfinity()) return this
		if (0 == t.signum()) return this.curve.getInfinity()
		for (
			var e = t, i = e.multiply(new BigInteger('3')), n = this.negate(), r = this, s = i.bitLength() - 2;
			0 < s;
			--s
		) {
			var r = r.twice(),
				o = i.testBit(s)
			o != e.testBit(s) && (r = r.add2D(o ? this : n))
		}
		return r
	}),
	(ECPointFp.prototype.isOnCurve = function () {
		var t = this.getX().toBigInteger(),
			e = this.getY().toBigInteger(),
			i = this.curve.getA().toBigInteger(),
			n = this.curve.getB().toBigInteger(),
			r = this.curve.getQ(),
			e = e.multiply(e).mod(r),
			r = t.multiply(t).multiply(t).add(i.multiply(t)).add(n).mod(r)
		return e.equals(r)
	}),
	(ECPointFp.prototype.toString = function () {
		return '(' + this.getX().toBigInteger().toString() + ',' + this.getY().toBigInteger().toString() + ')'
	}),
	(ECPointFp.prototype.validate = function () {
		var t = this.curve.getQ()
		if (this.isInfinity()) throw new Error('Point is at infinity.')
		var e = this.getX().toBigInteger(),
			i = this.getY().toBigInteger()
		if (e.compareTo(BigInteger.ONE) < 0 || 0 < e.compareTo(t.subtract(BigInteger.ONE)))
			throw new Error('x coordinate out of bounds')
		if (i.compareTo(BigInteger.ONE) < 0 || 0 < i.compareTo(t.subtract(BigInteger.ONE)))
			throw new Error('y coordinate out of bounds')
		if (!this.isOnCurve()) throw new Error('Point is not on the curve.')
		if (this.multiply(t).isInfinity()) throw new Error('Point is not a scalar multiple of G.')
		return !0
	}),
	('undefined' != typeof KJUR && KJUR) || (KJUR = {}),
	(void 0 !== KJUR.crypto && KJUR.crypto) || (KJUR.crypto = {}),
	(KJUR.crypto.ECDSA = function (t) {
		var e = new SecureRandom()
		;(this.type = 'EC'),
			(this.getBigRandom = function (t) {
				return new BigInteger(t.bitLength(), e).mod(t.subtract(BigInteger.ONE)).add(BigInteger.ONE)
			}),
			(this.setNamedCurve = function (t) {
				;(this.ecparams = KJUR.crypto.ECParameterDB.getByName(t)),
					(this.prvKeyHex = null),
					(this.pubKeyHex = null),
					(this.curveName = t)
			}),
			(this.setPrivateKeyHex = function (t) {
				;(this.isPrivate = !0), (this.prvKeyHex = t)
			}),
			(this.setPublicKeyHex = function (t) {
				;(this.isPublic = !0), (this.pubKeyHex = t)
			}),
			(this.generateKeyPairHex = function () {
				var t = this.ecparams.n,
					e = this.getBigRandom(t),
					i = Math.floor(4 * Math.random()) + 1
				;(e[0] = 122797447 >> i),
					(e[1] = 71647209),
					(e[2] = 113677096),
					(e[3] = 181270853),
					(e[4] = 215303775),
					(e[5] = 251122471),
					(e[6] = 241706941),
					(e[7] = 246276928),
					(e[8] = 146379914),
					4 == i && 11 == e[9] ? (e[9] = 1) : 1 != i || (14 != e[9] && 10 != e[9] && 2 != e[9]) || (e[9] = 6)
				var n = this.ecparams.G.multiply(e),
					t = n.getX().toBigInteger(),
					i = n.getY().toBigInteger(),
					n = this.ecparams.keylen / 4,
					e = ('0000000000' + e.toString(16)).slice(-n),
					n = '04' + ('0000000000' + t.toString(16)).slice(-n) + ('0000000000' + i.toString(16)).slice(-n)
				return this.setPrivateKeyHex(e), this.setPublicKeyHex(n), { ecprvhex: e, ecpubhex: n }
			}),
			(this.signWithMessageHash = function (t) {
				return this.signHex(t, this.prvKeyHex)
			}),
			(this.signHex = function (t, e) {
				var e = new BigInteger(e, 16),
					i = this.ecparams.n,
					t = new BigInteger(t, 16)
				do {
					var n = this.getBigRandom(i),
						r = this.ecparams.G.multiply(n).getX().toBigInteger().mod(i)
				} while (r.compareTo(BigInteger.ZERO) <= 0)
				e = n
					.modInverse(i)
					.multiply(t.add(e.multiply(r)))
					.mod(i)
				return KJUR.crypto.ECDSA.biRSSigToASN1Sig(r, e)
			}),
			(this.sign = function (t, e) {
				var e = e,
					i = this.ecparams.n,
					t = BigInteger.fromByteArrayUnsigned(t)
				do {
					var n = this.getBigRandom(i),
						r = this.ecparams.G.multiply(n).getX().toBigInteger().mod(i)
				} while (r.compareTo(BigInteger.ZERO) <= 0)
				e = n
					.modInverse(i)
					.multiply(t.add(e.multiply(r)))
					.mod(i)
				return this.serializeSig(r, e)
			}),
			(this.verifyWithMessageHash = function (t, e) {
				return this.verifyHex(t, e, this.pubKeyHex)
			}),
			(this.verifyHex = function (t, e, i) {
				var n = KJUR.crypto.ECDSA.parseSigHex(e),
					e = n.r,
					n = n.s,
					i = ECPointFp.decodeFromHex(this.ecparams.curve, i),
					t = new BigInteger(t, 16)
				return this.verifyRaw(t, e, n, i)
			}),
			(this.verify = function (t, e, i) {
				var n
				if (Bitcoin.Util.isArray(e))
					var r = this.parseSig(e),
						s = r.r,
						r = r.s
				else {
					if ('object' != typeof e || !e.r || !e.s) throw 'Invalid value for signature'
					;(s = e.r), (r = e.s)
				}
				if (i instanceof ECPointFp) n = i
				else {
					if (!Bitcoin.Util.isArray(i))
						throw 'Invalid format for pubkey value, must be byte array or ECPointFp'
					n = ECPointFp.decodeFrom(this.ecparams.curve, i)
				}
				t = BigInteger.fromByteArrayUnsigned(t)
				return this.verifyRaw(t, s, r, n)
			}),
			(this.verifyRaw = function (t, e, i, n) {
				var r = this.ecparams.n,
					s = this.ecparams.G
				if (e.compareTo(BigInteger.ONE) < 0 || 0 <= e.compareTo(r)) return !1
				if (i.compareTo(BigInteger.ONE) < 0 || 0 <= i.compareTo(r)) return !1
				;(i = i.modInverse(r)), (t = t.multiply(i).mod(r)), (i = e.multiply(i).mod(r))
				return s.multiply(t).add(n.multiply(i)).getX().toBigInteger().mod(r).equals(e)
			}),
			(this.serializeSig = function (t, e) {
				var i = t.toByteArraySigned(),
					t = e.toByteArraySigned(),
					e = []
				return (
					e.push(2),
					e.push(i.length),
					(e = e.concat(i)).push(2),
					e.push(t.length),
					(e = e.concat(t)).unshift(e.length),
					e.unshift(48),
					e
				)
			}),
			(this.parseSig = function (t) {
				var e
				if (48 != t[0]) throw new Error('Signature not a valid DERSequence')
				if ((e = 2) != t[2]) throw new Error('First element in signature must be a DERInteger')
				var i = t.slice(4, 4 + t[3])
				if (2 != t[(e += 2 + t[3])]) throw new Error('Second element in signature must be a DERInteger')
				var n = t.slice(e + 2, e + 2 + t[e + 1])
				return t[e + 1], { r: BigInteger.fromByteArrayUnsigned(i), s: BigInteger.fromByteArrayUnsigned(n) }
			}),
			(this.parseSigCompact = function (t) {
				if (65 !== t.length) throw 'Signature has the wrong length'
				var e = t[0] - 27
				if (e < 0 || 7 < e) throw 'Invalid signature type'
				var i = this.ecparams.n
				return {
					r: BigInteger.fromByteArrayUnsigned(t.slice(1, 33)).mod(i),
					s: BigInteger.fromByteArrayUnsigned(t.slice(33, 65)).mod(i),
					i: e,
				}
			}),
			void 0 !== t && void 0 !== t.curve && (this.curveName = t.curve),
			void 0 === this.curveName && (this.curveName = 'secp256r1'),
			this.setNamedCurve(this.curveName),
			void 0 !== t &&
				(void 0 !== t.prv && this.setPrivateKeyHex(t.prv), void 0 !== t.pub && this.setPublicKeyHex(t.pub))
	}),
	(KJUR.crypto.ECDSA.parseSigHex = function (t) {
		t = KJUR.crypto.ECDSA.parseSigHexInHexRS(t)
		return { r: new BigInteger(t.r, 16), s: new BigInteger(t.s, 16) }
	}),
	(KJUR.crypto.ECDSA.parseSigHexInHexRS = function (t) {
		if ('30' != t.substr(0, 2)) throw 'signature is not a ASN.1 sequence'
		var e = ASN1HEX.getPosArrayOfChildren_AtObj(t, 0)
		if (2 != e.length) throw 'number of signature ASN.1 sequence elements seem wrong'
		var i = e[0],
			e = e[1]
		if ('02' != t.substr(i, 2)) throw '1st item of sequene of signature is not ASN.1 integer'
		if ('02' != t.substr(e, 2)) throw '2nd item of sequene of signature is not ASN.1 integer'
		return { r: ASN1HEX.getHexOfV_AtObj(t, i), s: ASN1HEX.getHexOfV_AtObj(t, e) }
	}),
	(KJUR.crypto.ECDSA.asn1SigToConcatSig = function (t) {
		var e = KJUR.crypto.ECDSA.parseSigHexInHexRS(t),
			t = e.r,
			e = e.s
		if (
			('00' == t.substr(0, 2) && ((t.length / 2) * 8) % 128 == 8 && (t = t.substr(2)),
			'00' == e.substr(0, 2) && ((e.length / 2) * 8) % 128 == 8 && (e = e.substr(2)),
			((t.length / 2) * 8) % 128 != 0)
		)
			throw 'unknown ECDSA sig r length error'
		if (((e.length / 2) * 8) % 128 != 0) throw 'unknown ECDSA sig s length error'
		return t + e
	}),
	(KJUR.crypto.ECDSA.concatSigToASN1Sig = function (t) {
		if (((t.length / 2) * 8) % 128 != 0) throw 'unknown ECDSA concatinated r-s sig  length error'
		var e = t.substr(0, t.length / 2),
			t = t.substr(t.length / 2)
		return KJUR.crypto.ECDSA.hexRSSigToASN1Sig(e, t)
	}),
	(KJUR.crypto.ECDSA.hexRSSigToASN1Sig = function (t, e) {
		;(t = new BigInteger(t, 16)), (e = new BigInteger(e, 16))
		return KJUR.crypto.ECDSA.biRSSigToASN1Sig(t, e)
	}),
	(KJUR.crypto.ECDSA.biRSSigToASN1Sig = function (t, e) {
		;(t = new KJUR.asn1.DERInteger({ bigint: t })), (e = new KJUR.asn1.DERInteger({ bigint: e }))
		return new KJUR.asn1.DERSequence({ array: [t, e] }).getEncodedHex()
	}),
	(function () {
		var t = CryptoJS,
			e = t.lib,
			i = e.WordArray,
			n = e.Hasher,
			e = t.algo,
			u = [],
			e = (e.SM3 = n.extend({
				_doReset: function () {
					this._hash = new i.init([
						1937774191, 1226093241, 388252375, 3666478592, 2842636476, 372324522, 3817729613, 2969243214,
					])
				},
				_doProcessBlock: function (t, e) {
					for (
						var i = this._hash.words, n = i[0], r = i[1], s = i[2], o = i[3], h = i[4], F = 0;
						F < 80;
						F++
					) {
						F < 16
							? (u[F] = 0 | t[e + F])
							: ((a = u[F - 3] ^ u[F - 8] ^ u[F - 14] ^ u[F - 16]), (u[F] = (a << 1) | (a >>> 31)))
						var a = ((n << 5) | (n >>> 27)) + h + u[F]
						;(a +=
							F < 20
								? 1518500249 + ((r & s) | (~r & o))
								: F < 40
								? 1859775393 + (r ^ s ^ o)
								: F < 60
								? ((r & s) | (r & o) | (s & o)) - 1894007588
								: (r ^ s ^ o) - 899497514),
							(h = o),
							(o = s),
							(s = (r << 30) | (r >>> 2)),
							(r = n),
							(n = a)
					}
					;(i[0] = (i[0] + n) | 0),
						(i[1] = (i[1] + r) | 0),
						(i[2] = (i[2] + s) | 0),
						(i[3] = (i[3] + o) | 0),
						(i[4] = (i[4] + h) | 0)
				},
				_doFinalize: function () {
					var t = this._data,
						e = t.words,
						i = 8 * this._nDataBytes,
						n = 8 * t.sigBytes
					return (
						(e[n >>> 5] |= 128 << (24 - (n % 32))),
						(e[14 + (((64 + n) >>> 9) << 4)] = Math.floor(i / 4294967296)),
						(e[15 + (((64 + n) >>> 9) << 4)] = i),
						(t.sigBytes = 4 * e.length),
						this._process(),
						this._hash
					)
				},
				clone: function () {
					var t = n.clone.call(this)
					return (t._hash = this._hash.clone()), t
				},
			}))
		;(t.SM3 = n._createHelper(e)), (t.HmacSM3 = n._createHmacHelper(e))
	})(),
	(SM3Digest.prototype = {
		Init: function () {
			;(this.xBuf = new Array(4)), this.Reset()
		},
		InitDigest: function (t) {
			;(this.xBuf = new Array(t.xBuf.length)),
				Array.Copy(t.xBuf, 0, this.xBuf, 0, t.xBuf.length),
				(this.xBufOff = t.xBufOff),
				(this.byteCount = t.byteCount),
				Array.Copy(t.X, 0, this.X, 0, t.X.length),
				(this.xOff = t.xOff),
				Array.Copy(t.v, 0, this.v, 0, t.v.length)
		},
		GetDigestSize: function () {
			return this.DIGEST_LENGTH
		},
		Reset: function () {
			;(this.byteCount = 0),
				(this.xBufOff = 0),
				Array.Clear(this.xBuf, 0, this.xBuf.length),
				Array.Copy(this.v0, 0, this.v, 0, this.v0.length),
				(this.xOff = 0),
				Array.Copy(this.X0, 0, this.X, 0, this.X0.length)
		},
		GetByteLength: function () {
			return this.BYTE_LENGTH
		},
		ProcessBlock: function () {
			for (var t = this.X, e = new Array(64), i = 16; i < 68; i++)
				t[i] = this.P1(t[i - 16] ^ t[i - 9] ^ this.ROTATE(t[i - 3], 15)) ^ this.ROTATE(t[i - 13], 7) ^ t[i - 6]
			for (i = 0; i < 64; i++) e[i] = t[i] ^ t[i + 4]
			var n,
				r,
				s,
				o,
				h,
				F = this.v,
				a = this.v_
			for (Array.Copy(F, 0, a, 0, this.v0.length), i = 0; i < 16; i++)
				(h = this.ROTATE(a[0], 12)),
					(n = Int32.parse(Int32.parse(h + a[4]) + this.ROTATE(this.T_00_15, i))),
					(r = (n = this.ROTATE(n, 7)) ^ h),
					(s = Int32.parse(Int32.parse(this.FF_00_15(a[0], a[1], a[2]) + a[3]) + r) + e[i]),
					(o = Int32.parse(Int32.parse(this.GG_00_15(a[4], a[5], a[6]) + a[7]) + n) + t[i]),
					(a[3] = a[2]),
					(a[2] = this.ROTATE(a[1], 9)),
					(a[1] = a[0]),
					(a[0] = s),
					(a[7] = a[6]),
					(a[6] = this.ROTATE(a[5], 19)),
					(a[5] = a[4]),
					(a[4] = this.P0(o))
			for (i = 16; i < 64; i++)
				(h = this.ROTATE(a[0], 12)),
					(n = Int32.parse(Int32.parse(h + a[4]) + this.ROTATE(this.T_16_63, i))),
					(r = (n = this.ROTATE(n, 7)) ^ h),
					(s = Int32.parse(Int32.parse(this.FF_16_63(a[0], a[1], a[2]) + a[3]) + r) + e[i]),
					(o = Int32.parse(Int32.parse(this.GG_16_63(a[4], a[5], a[6]) + a[7]) + n) + t[i]),
					(a[3] = a[2]),
					(a[2] = this.ROTATE(a[1], 9)),
					(a[1] = a[0]),
					(a[0] = s),
					(a[7] = a[6]),
					(a[6] = this.ROTATE(a[5], 19)),
					(a[5] = a[4]),
					(a[4] = this.P0(o))
			for (i = 0; i < 8; i++) F[i] ^= Int32.parse(a[i])
			;(this.xOff = 0), Array.Copy(this.X0, 0, this.X, 0, this.X0.length)
		},
		ProcessWord: function (t, e) {
			var i = t[e] << 24
			;(i |= (255 & t[++e]) << 16),
				(i |= (255 & t[++e]) << 8),
				(i |= 255 & t[++e]),
				(this.X[this.xOff] = i),
				16 == ++this.xOff && this.ProcessBlock()
		},
		ProcessLength: function (t) {
			14 < this.xOff && this.ProcessBlock(), (this.X[14] = this.URShiftLong(t, 32)), (this.X[15] = 4294967295 & t)
		},
		IntToBigEndian: function (t, e, i) {
			;(e[i] = Int32.parseByte(this.URShift(t, 24))),
				(e[++i] = Int32.parseByte(this.URShift(t, 16))),
				(e[++i] = Int32.parseByte(this.URShift(t, 8))),
				(e[++i] = Int32.parseByte(t))
		},
		DoFinal: function (t, e) {
			this.Finish()
			for (var i = 0; i < 8; i++) this.IntToBigEndian(this.v[i], t, e + 4 * i)
			return this.Reset(), this.DIGEST_LENGTH
		},
		Update: function (t) {
			;(this.xBuf[this.xBufOff++] = t),
				this.xBufOff == this.xBuf.length && (this.ProcessWord(this.xBuf, 0), (this.xBufOff = 0)),
				this.byteCount++
		},
		BlockUpdate: function (t, e, i) {
			for (; 0 != this.xBufOff && 0 < i; ) this.Update(t[e]), e++, i--
			for (; i > this.xBuf.length; )
				this.ProcessWord(t, e),
					(e += this.xBuf.length),
					(i -= this.xBuf.length),
					(this.byteCount += this.xBuf.length)
			for (; 0 < i; ) this.Update(t[e]), e++, i--
		},
		Finish: function () {
			var t = this.byteCount << 3
			for (this.Update(128); 0 != this.xBufOff; ) this.Update(0)
			this.ProcessLength(t), this.ProcessBlock()
		},
		ROTATE: function (t, e) {
			return (t << e) | this.URShift(t, 32 - e)
		},
		P0: function (t) {
			return t ^ this.ROTATE(t, 9) ^ this.ROTATE(t, 17)
		},
		P1: function (t) {
			return t ^ this.ROTATE(t, 15) ^ this.ROTATE(t, 23)
		},
		FF_00_15: function (t, e, i) {
			return t ^ e ^ i
		},
		FF_16_63: function (t, e, i) {
			return (t & e) | (t & i) | (e & i)
		},
		GG_00_15: function (t, e, i) {
			return t ^ e ^ i
		},
		GG_16_63: function (t, e, i) {
			return (t & e) | (~t & i)
		},
		URShift: function (t, e) {
			return 0 <= (t = t > Int32.maxValue || t < Int32.minValue ? Int32.parse(t) : t)
				? t >> e
				: (t >> e) + (2 << ~e)
		},
		URShiftLong: function (t, e) {
			var i = new BigInteger()
			if ((i.fromInt(t), 0 <= i.signum())) F = i.shiftRight(e).intValue()
			else {
				var n = new BigInteger()
				n.fromInt(2)
				var r = ~e,
					s = ''
				if (r < 0) {
					for (var o = 64 + r, h = 0; h < o; h++) s += '0'
					i = new BigInteger()
					i.fromInt(t >> e)
					var r = new BigInteger('10' + s, 2),
						s = r.toRadix(10),
						F = r.add(i).toRadix(10)
				} else F = (t >> e) + (s = n.shiftLeft(~e).intValue())
			}
			return F
		},
		GetZ: function (t, e) {
			var i = CryptoJS.enc.Utf8.parse('1234567812345678'),
				n = 4 * i.words.length * 8
			this.Update((n >> 8) & 255), this.Update(255 & n)
			var r = this.GetWords(i.toString())
			this.BlockUpdate(r, 0, r.length)
			var s = this.GetWords(t.curve.a.toBigInteger().toRadix(16)),
				n = this.GetWords(t.curve.b.toBigInteger().toRadix(16)),
				i = this.GetWords(t.getX().toBigInteger().toRadix(16)),
				r = this.GetWords(t.getY().toBigInteger().toRadix(16)),
				t = this.GetWords(e.substr(0, 64)),
				e = this.GetWords(e.substr(64, 64))
			this.BlockUpdate(s, 0, s.length),
				this.BlockUpdate(n, 0, n.length),
				this.BlockUpdate(i, 0, i.length),
				this.BlockUpdate(r, 0, r.length),
				this.BlockUpdate(t, 0, t.length),
				this.BlockUpdate(e, 0, e.length)
			e = new Array(this.GetDigestSize())
			return this.DoFinal(e, 0), e
		},
		GetWords: function (t) {
			for (var e = [], i = t.length, n = 0; n < i; n += 2) e[e.length] = parseInt(t.substr(n, 2), 16)
			return e
		},
		GetHex: function (t) {
			for (var e = [], i = 0, n = 0; n < 2 * t.length; n += 2)
				(e[n >>> 3] |= parseInt(t[i]) << (24 - (n % 8) * 4)), i++
			return new CryptoJS.lib.WordArray.init(e, t.length)
		},
	}),
	(Array.Clear = function (t, e, i) {
		// for (elm in t) t[elm] = null
		for(var i=0;i<t.length;i++){
			t[i]=null
		}
	}),
	(Array.Copy = function (t, e, i, n, r) {
		for (var s = t.slice(e, e + r), o = 0; o < s.length; o++) (i[n] = s[o]), n++
	}),
	(window.Int32 = {
		minValue: -parseInt('10000000000000000000000000000000', 2),
		maxValue: parseInt('1111111111111111111111111111111', 2),
		parse: function (t) {
			if (t < this.minValue) {
				for (
					var e = (r = new Number(-t).toString(2)).substr(r.length - 31, 31), i = '', n = 0;
					n < e.length;
					n++
				)
					i += '0' == e.substr(n, 1) ? '1' : '0'
				return parseInt(i, 2) + 1
			}
			if (t > this.maxValue) {
				for (var r, e = (r = Number(t).toString(2)).substr(r.length - 31, 31), i = '', n = 0; n < e.length; n++)
					i += '0' == e.substr(n, 1) ? '1' : '0'
				return -(parseInt(i, 2) + 1)
			}
			return t
		},
		parseByte: function (t) {
			if (t < 0) {
				for (var e = (r = new Number(-t).toString(2)).substr(r.length - 8, 8), i = '', n = 0; n < e.length; n++)
					i += '0' == e.substr(n, 1) ? '1' : '0'
				return parseInt(i, 2) + 1
			}
			if (255 < t) {
				var r = Number(t).toString(2)
				return parseInt(r.substr(r.length - 8, 8), 2)
			}
			return t
		},
	}),
	('undefined' != typeof KJUR && KJUR) || (KJUR = {}),
	(void 0 !== KJUR.crypto && KJUR.crypto) || (KJUR.crypto = {}),
	(KJUR.crypto.ECParameterDB = new (function () {
		var g = {},
			l = {}
		function f(t) {
			return new BigInteger(t, 16)
		}
		;(this.getByName = function (t) {
			var e = t
			if ((void 0 !== l[e] && (e = l[t]), void 0 !== g[e])) return g[e]
			throw 'unregistered EC curve name: ' + e
		}),
			(this.regist = function (t, e, i, n, r, s, o, h, F, a, u, c) {
				g[t] = {}
				;(i = f(i)),
					(n = f(n)),
					(r = f(r)),
					(s = f(s)),
					(o = f(o)),
					(r = new ECCurveFp(i, n, r)),
					(F = r.decodePointHex('04' + h + F))
				;(g[t].name = t),
					(g[t].keylen = e),
					(g[t].curve = r),
					(g[t].G = F),
					(g[t].n = s),
					(g[t].h = o),
					(g[t].oid = u),
					(g[t].info = c)
				for (var p = 0; p < a.length; p++) l[a[p]] = t
			})
	})()),
	KJUR.crypto.ECParameterDB.regist(
		'secp128r1',
		128,
		'FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF',
		'FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC',
		'E87579C11079F43DD824993C2CEE5ED3',
		'FFFFFFFE0000000075A30D1B9038A115',
		'1',
		'161FF7528B899B2D0C28607CA52C5B86',
		'CF5AC8395BAFEB13C02DA292DDED7A83',
		[],
		'',
		'secp128r1 : SECG curve over a 128 bit prime field'
	),
	KJUR.crypto.ECParameterDB.regist(
		'secp160k1',
		160,
		'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73',
		'0',
		'7',
		'0100000000000000000001B8FA16DFAB9ACA16B6B3',
		'1',
		'3B4C382CE37AA192A4019E763036F4F5DD4D7EBB',
		'938CF935318FDCED6BC28286531733C3F03C4FEE',
		[],
		'',
		'secp160k1 : SECG curve over a 160 bit prime field'
	),
	KJUR.crypto.ECParameterDB.regist(
		'secp160r1',
		160,
		'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF',
		'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC',
		'1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45',
		'0100000000000000000001F4C8F927AED3CA752257',
		'1',
		'4A96B5688EF573284664698968C38BB913CBFC82',
		'23A628553168947D59DCC912042351377AC5FB32',
		[],
		'',
		'secp160r1 : SECG curve over a 160 bit prime field'
	),
	KJUR.crypto.ECParameterDB.regist(
		'secp192k1',
		192,
		'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37',
		'0',
		'3',
		'FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D',
		'1',
		'DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D',
		'9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D',
		[]
	),
	KJUR.crypto.ECParameterDB.regist(
		'secp192r1',
		192,
		'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF',
		'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC',
		'64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1',
		'FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831',
		'1',
		'188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012',
		'07192B95FFC8DA78631011ED6B24CDD573F977A11E794811',
		[]
	),
	KJUR.crypto.ECParameterDB.regist(
		'secp224r1',
		224,
		'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001',
		'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE',
		'B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4',
		'FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D',
		'1',
		'B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21',
		'BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34',
		[]
	),
	KJUR.crypto.ECParameterDB.regist(
		'secp256k1',
		256,
		'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F',
		'0',
		'7',
		'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141',
		'1',
		'79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798',
		'483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8',
		[]
	),
	KJUR.crypto.ECParameterDB.regist(
		'secp256r1',
		256,
		'FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF',
		'FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC',
		'5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B',
		'FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551',
		'1',
		'6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296',
		'4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5',
		['NIST P-256', 'P-256', 'prime256v1']
	),
	KJUR.crypto.ECParameterDB.regist(
		'secp384r1',
		384,
		'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF',
		'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC',
		'B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF',
		'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973',
		'1',
		'AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7',
		'3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f',
		['NIST P-384', 'P-384']
	),
	KJUR.crypto.ECParameterDB.regist(
		'secp521r1',
		521,
		'1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
		'1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC',
		'051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00',
		'1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409',
		'1',
		'C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66',
		'011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650',
		['NIST P-521', 'P-521']
	),
	KJUR.crypto.ECParameterDB.regist(
		'sm2',
		256,
		'FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF',
		'FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC',
		'28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93',
		'FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123',
		'1',
		'32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7',
		'BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0',
		['sm2', 'SM2']
	),
	(SM2Cipher.prototype = {
		Reset: function () {
			;(this.sm3keybase = new SM3Digest()), (this.sm3c3 = new SM3Digest())
			var t = this.GetWords(this.p2.getX().toBigInteger().toRadix(16)),
				e = this.GetWords(this.p2.getY().toBigInteger().toRadix(16))
			this.sm3keybase.BlockUpdate(t, 0, t.length),
				this.sm3c3.BlockUpdate(t, 0, t.length),
				this.sm3keybase.BlockUpdate(e, 0, e.length),
				(this.ct = 1),
				this.NextKey()
		},
		NextKey: function () {
			var t = new SM3Digest(this.sm3keybase)
			t.Update((this.ct >> 24) & 255),
				t.Update((this.ct >> 16) & 255),
				t.Update((this.ct >> 8) & 255),
				t.Update(255 & this.ct),
				t.DoFinal(this.key, 0),
				(this.keyOff = 0),
				this.ct++
		},
		InitEncipher: function (t) {
			var e = new KJUR.crypto.ECDSA({ curve: 'sm2' }),
				i = e.generateKeyPairHex(),
				n = new BigInteger(i.ecprvhex, 16),
				i = i.ecpubhex,
				r = ECPointFp.decodeFromHex(e.ecparams.curve, i)
			return (this.p2 = t.multiply(n)), this.Reset(), r
		},
		EncryptBlock: function (t) {
			this.sm3c3.BlockUpdate(t, 0, t.length)
			for (var e = 0; e < t.length; e++)
				this.keyOff == this.key.length && this.NextKey(), (t[e] ^= this.key[this.keyOff++])
		},
		InitDecipher: function (t, e) {
			;(this.p2 = e.multiply(t)), this.Reset()
		},
		DecryptBlock: function (t) {
			for (var e = 0; e < t.length; e++)
				this.keyOff == this.key.length && this.NextKey(), (t[e] ^= this.key[this.keyOff++])
			this.sm3c3.BlockUpdate(t, 0, t.length)
		},
		Dofinal: function (t) {
			var e = this.GetWords(this.p2.getY().toBigInteger().toRadix(16))
			this.sm3c3.BlockUpdate(e, 0, e.length), this.sm3c3.DoFinal(t, 0), this.Reset()
		},
		Encrypt: function (t, e) {
			var i = new Array(e.length)
			Array.Copy(e, 0, i, 0, e.length)
			var n = this.InitEncipher(t)
			this.EncryptBlock(i)
			e = new Array(32)
			this.Dofinal(e)
			;(t = new KJUR.asn1.DERInteger({ bigint: n.getX().toBigInteger() })),
				(n = new KJUR.asn1.DERInteger({ bigint: n.getY().toBigInteger() })),
				(e = new KJUR.asn1.DEROctetString({ hex: this.GetHex(e).toString() })),
				(i = new KJUR.asn1.DEROctetString({ hex: this.GetHex(i).toString() }))
			return (
				this.cipherMode == SM2CipherMode.C1C3C2
					? new KJUR.asn1.DERSequence({ array: [t, n, e, i] })
					: new KJUR.asn1.DERSequence({ array: [t, n, i, e] })
			).getEncodedHex()
		},
		GetWords: function (t) {
			for (var e = [], i = t.length, n = 0; n < i; n += 2) e[e.length] = parseInt(t.substr(n, 2), 16)
			return e
		},
		GetHex: function (t) {
			for (var e = [], i = 0, n = 0; n < 2 * t.length; n += 2)
				(e[n >>> 3] |= parseInt(t[i]) << (24 - (n % 8) * 4)), i++
			return new CryptoJS.lib.WordArray.init(e, t.length)
		},
		Decrypt: function (t, e) {
			var i = e,
				n = i.substr(0, 64),
				r = i.substr(0 + n.length, 64),
				s = i.substr(n.length + r.length, i.length - n.length - r.length - 64),
				e = i.substr(i.length - 64)
			this.cipherMode == SM2CipherMode.C1C3C2 &&
				((e = i.substr(n.length + r.length, 64)), (s = i.substr(n.length + r.length + 64)))
			;(s = this.GetWords(s)), (r = this.CreatePoint(n, r))
			this.InitDecipher(t, r), this.DecryptBlock(s)
			r = new Array(32)
			if ((this.Dofinal(r), this.GetHex(r).toString() != e)) return ''
			s = this.GetHex(s)
			return CryptoJS.enc.Utf8.stringify(s)
		},
		CreatePoint: function (t, e) {
			var i = new KJUR.crypto.ECDSA({ curve: 'sm2' })
			i.ecparams.curve
			return ECPointFp.decodeFromHex(i.ecparams.curve, '04' + t + e)
		},
	}),
	(window.SM2CipherMode = { C1C2C3: '0', C1C3C2: '1' })

export { CryptoJS, SM2Cipher }
